diff options
author | pcadach <pcadach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-30 09:10:09 +0000 |
---|---|---|
committer | pcadach <pcadach@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-30 09:10:09 +0000 |
commit | eaa637401283e4dfcde39aa20890c3260ce3f0b0 (patch) | |
tree | dac9071df56cbcbffce79e563ce6ca3e0a333fd0 /res | |
parent | 8fa72c1f27d50d5805486ca43f56e0b3c9fdac5d (diff) |
Merged revisions 52808 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r52808 | pcadach | 2007-01-30 00:34:26 -0800 (Втр, 30 Янв 2007) | 1 line
Don't play with free()'d pointers
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@52819 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_odbc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c index 9ee3b8fc9..6f9f8a2df 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -363,7 +363,8 @@ static int odbc_register_class(struct odbc_class *class, int connect) if (connect) { /* Request and release builds a connection */ obj = ast_odbc_request_obj(class->name, 0); - ast_odbc_release_obj(obj); + if (obj) + ast_odbc_release_obj(obj); } return 0; @@ -434,9 +435,10 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check) ast_mutex_init(&obj->lock); obj->parent = class; if (odbc_obj_connect(obj) == ODBC_FAIL) { - ast_log(LOG_WARNING, "Failed to connect\n"); + ast_log(LOG_WARNING, "Failed to connect to %s\n", name); ast_mutex_destroy(&obj->lock); free(obj); + obj = NULL; } else { AST_LIST_INSERT_HEAD(&class->odbc_obj, obj, list); } |