mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-07 02:18:15 +00:00
Ensure the connection gets marked as used at allocation time (closes issue #10429, report and fix by mnicholson)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -413,8 +413,16 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
|
|||||||
}
|
}
|
||||||
ast_mutex_init(&obj->lock);
|
ast_mutex_init(&obj->lock);
|
||||||
obj->parent = class;
|
obj->parent = class;
|
||||||
odbc_obj_connect(obj);
|
if (odbc_obj_connect(obj) == ODBC_FAIL) {
|
||||||
AST_LIST_INSERT_TAIL(&class->odbc_obj, obj, list);
|
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
|
||||||
|
ast_mutex_destroy(&obj->lock);
|
||||||
|
free(obj);
|
||||||
|
obj = NULL;
|
||||||
|
class->count--;
|
||||||
|
} else {
|
||||||
|
obj->used = 1;
|
||||||
|
AST_LIST_INSERT_TAIL(&class->odbc_obj, obj, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Non-pooled connection: multiple modules can use the same connection. */
|
/* Non-pooled connection: multiple modules can use the same connection. */
|
||||||
|
|||||||
Reference in New Issue
Block a user