[asterisk-commits] pcadach: branch 1.4 r52808 - /branches/1.4/res/res_odbc.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 30 01:34:27 MST 2007


Author: pcadach
Date: Tue Jan 30 02:34:26 2007
New Revision: 52808

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52808
Log:
Don't play with free()'d pointers

Modified:
    branches/1.4/res/res_odbc.c

Modified: branches/1.4/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_odbc.c?view=diff&rev=52808&r1=52807&r2=52808
==============================================================================
--- branches/1.4/res/res_odbc.c (original)
+++ branches/1.4/res/res_odbc.c Tue Jan 30 02:34:26 2007
@@ -360,7 +360,8 @@
 		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;
@@ -431,9 +432,10 @@
 			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);
 			}



More information about the asterisk-commits mailing list