[asterisk-commits] tilghman: trunk r79147 - in /trunk: ./ res/res_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Aug 11 00:28:09 CDT 2007


Author: tilghman
Date: Sat Aug 11 00:28:08 2007
New Revision: 79147

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

........

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=79147&r1=79146&r2=79147
==============================================================================
--- trunk/res/res_odbc.c (original)
+++ trunk/res/res_odbc.c Sat Aug 11 00:28:08 2007
@@ -416,8 +416,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 asterisk-commits mailing list