aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-22 23:36:02 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-22 23:36:02 +0000
commit695a84cd4855c91000bd711d74a99b5c9f9c1436 (patch)
tree7f2eb3d693197471060a931297139248e003c67f
parent86342904e49513c4e08f0305e057f4d6ccb59046 (diff)
Merged revisions 320445 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r320445 | tilghman | 2011-05-22 18:34:57 -0500 (Sun, 22 May 2011) | 15 lines Merged revisions 320444 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r320444 | tilghman | 2011-05-22 18:25:51 -0500 (Sun, 22 May 2011) | 8 lines 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 ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@320446 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--res/res_odbc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 14cf05368..b1e72ac8d 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -1235,10 +1235,11 @@ struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags
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);