aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-18 19:36:23 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-18 19:36:23 +0000
commit7d2987e2ec9d520e89a8395c39f56407e28b76cf (patch)
treecb4ef1e2b58f05af6425ccad4d6e122c3f3fcf4e /res
parent20df795262d55b31ec8b1c793e2a1ce45af6faae (diff)
Merged revisions 165724 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r165724 | mmichelson | 2008-12-18 13:34:33 -0600 (Thu, 18 Dec 2008) | 8 lines Fix crashes in res_odbc. The variable "class" was being set NULL just prior to being dereferenced in an ao2_link call. I have moved the setting of the variable to NULL until after the ao2_link call. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@165725 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_odbc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c
index d58864da0..d0580d4cb 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -697,7 +697,6 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
ast_mutex_init(&obj->lock);
/* obj inherits the outstanding reference to class */
obj->parent = class;
- class = NULL;
if (odbc_obj_connect(obj) == ODBC_FAIL) {
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
ao2_ref(obj, -1);
@@ -706,6 +705,7 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
obj->used = 1;
ao2_link(class->obj_container, obj);
}
+ class = NULL;
} else {
/* Object is not constructed, so delete outstanding reference to class. */
ao2_ref(class, -1);
@@ -733,7 +733,6 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
ast_mutex_init(&obj->lock);
/* obj inherits the outstanding reference to class */
obj->parent = class;
- class = NULL;
if (odbc_obj_connect(obj) == ODBC_FAIL) {
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
ao2_ref(obj, -1);
@@ -741,6 +740,7 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
} else {
ao2_link(class->obj_container, obj);
}
+ class = NULL;
}
}