Merged revisions 79142 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79142 | tilghman | 2007-08-11 00:23:04 -0500 (Sat, 11 Aug 2007) | 2 lines

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/trunk@79147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher 2007-08-11 05:28:08 +00:00
parent 9b3c3f1c61
commit 89588a043f
1 changed files with 10 additions and 2 deletions

View File

@ -416,8 +416,16 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
}
ast_mutex_init(&obj->lock);
obj->parent = class;
odbc_obj_connect(obj);
AST_LIST_INSERT_TAIL(&class->odbc_obj, obj, list);
if (odbc_obj_connect(obj) == ODBC_FAIL) {
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 {
/* Non-pooled connection: multiple modules can use the same connection. */