[asterisk-commits] mmichelson: branch 1.6.1 r165725 - in /branches/1.6.1: ./ res/res_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 18 13:36:24 CST 2008


Author: mmichelson
Date: Thu Dec 18 13:36:23 2008
New Revision: 165725

URL: http://svn.digium.com/view/asterisk?view=rev&rev=165725
Log:
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.


........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/res/res_odbc.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/res/res_odbc.c?view=diff&rev=165725&r1=165724&r2=165725
==============================================================================
--- branches/1.6.1/res/res_odbc.c (original)
+++ branches/1.6.1/res/res_odbc.c Thu Dec 18 13:36:23 2008
@@ -697,7 +697,6 @@
 			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 @@
 				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 @@
 			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 @@
 			} else {
 				ao2_link(class->obj_container, obj);
 			}
+			class = NULL;
 		}
 	}
 




More information about the asterisk-commits mailing list