diff options
author | Mark Michelson <mmichelson@digium.com> | 2008-12-18 19:34:33 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2008-12-18 19:34:33 +0000 |
commit | 221694480c1d9b99a0d24890860b8bbbc7733975 (patch) | |
tree | 236005663bff0012f0da17ed6caf8b5dd301e2fc /res/res_odbc.c | |
parent | 50a25ac8474d7900ba59a68ed4fd942074082435 (diff) |
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: https://origsvn.digium.com/svn/asterisk/trunk@165724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_odbc.c')
-rw-r--r-- | res/res_odbc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c index 8161fd3bf..5864c7da4 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -699,7 +699,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); @@ -708,6 +707,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); @@ -735,7 +735,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); @@ -743,6 +742,7 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check) } else { ao2_link(class->obj_container, obj); } + class = NULL; } } |