[asterisk-commits] tilghman: branch 1.6.2 r320444 - /branches/1.6.2/res/res_odbc.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun May 22 18:26:06 CDT 2011
Author: tilghman
Date: Sun May 22 18:25:51 2011
New Revision: 320444
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=320444
Log:
Don't crash when the connection fails.
(closes issue #19250)
Reported by: seadweller
Patches:
20110514__issue19250.diff.txt uploaded by tilghman (license 14)
Tested by: seadweller, sum
Modified:
branches/1.6.2/res/res_odbc.c
Modified: branches/1.6.2/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/res/res_odbc.c?view=diff&rev=320444&r1=320443&r2=320444
==============================================================================
--- branches/1.6.2/res/res_odbc.c (original)
+++ branches/1.6.2/res/res_odbc.c Sun May 22 18:25:51 2011
@@ -1191,10 +1191,11 @@
class = NULL;
if (odbc_obj_connect(obj) == ODBC_FAIL) {
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
+ ast_assert(ao2_ref(obj->parent, 0) > 0);
+ /* Because it was never within the container, we have to manually decrement the count here */
+ ast_atomic_fetchadd_int(&obj->parent->count, -1);
ao2_ref(obj, -1);
obj = NULL;
- ast_assert(ao2_ref(class, 0) > 0);
- ast_atomic_fetchadd_int(&class->count, -1);
} else {
obj->used = 1;
ao2_link(obj->parent->obj_container, obj);
More information about the asterisk-commits
mailing list