[asterisk-commits] pcadach: trunk r52819 - in /trunk: ./ res/res_odbc.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 30 02:10:10 MST 2007


Author: pcadach
Date: Tue Jan 30 03:10:09 2007
New Revision: 52819

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52819
Log:
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
........

Modified:
    trunk/   (props changed)
    trunk/res/res_odbc.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_odbc.c?view=diff&rev=52819&r1=52818&r2=52819
==============================================================================
--- trunk/res/res_odbc.c (original)
+++ trunk/res/res_odbc.c Tue Jan 30 03:10:09 2007
@@ -363,7 +363,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;
@@ -434,9 +435,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