[svn-commits] tilghman: branch 1.4 r79142 - /branches/1.4/res/res_odbc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Aug 11 00:23:06 CDT 2007


Author: tilghman
Date: Sat Aug 11 00:23:04 2007
New Revision: 79142

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79142
Log:
Ensure the connection gets marked as used at allocation time (closes issue #10429, report and fix by mnicholson)

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=79142&r1=79141&r2=79142
==============================================================================
--- branches/1.4/res/res_odbc.c (original)
+++ branches/1.4/res/res_odbc.c Sat Aug 11 00:23:04 2007
@@ -413,8 +413,16 @@
 			}
 			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. */




More information about the svn-commits mailing list