[asterisk-commits] russell: trunk r51207 - in /trunk: ./ funcs/func_odbc.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 17 16:35:44 MST 2007


Author: russell
Date: Wed Jan 17 17:35:43 2007
New Revision: 51207

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51207
Log:
Merged revisions 51205 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r51205 | russell | 2007-01-17 17:31:11 -0600 (Wed, 17 Jan 2007) | 5 lines

Fix some instances where when loading func_odbc, a double-free could occur.
Also, remove an unneeded error message.  If the failure condition is
actually a memory allocation failure, a log message will already be
generated automatically.

........

Modified:
    trunk/   (props changed)
    trunk/funcs/func_odbc.c

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

Modified: trunk/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_odbc.c?view=diff&rev=51207&r1=51206&r2=51207
==============================================================================
--- trunk/funcs/func_odbc.c (original)
+++ trunk/funcs/func_odbc.c Wed Jan 17 17:35:43 2007
@@ -431,6 +431,7 @@
 
 	if (!ast_strlen_zero((*query)->sql_read) && ast_strlen_zero((*query)->readhandle[0])) {
 		free(*query);
+		*query = NULL;
 		ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for reading: %s\n", catg);
 		return EINVAL;
 	}
@@ -443,6 +444,7 @@
 
 	if (!ast_strlen_zero((*query)->sql_write) && ast_strlen_zero((*query)->writehandle[0])) {
 		free(*query);
+		*query = NULL;
 		ast_log(LOG_ERROR, "There is SQL, but no ODBC class to be used for writing: %s\n", catg);
 		return EINVAL;
 	}
@@ -457,6 +459,7 @@
 	(*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
 	if (! (*query)->acf) {
 		free(*query);
+		*query = NULL;
 		return ENOMEM;
 	}
 
@@ -469,6 +472,7 @@
 	if (!((*query)->acf->name)) {
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return ENOMEM;
 	}
 
@@ -478,6 +482,7 @@
 		free((char *)(*query)->acf->name);
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return ENOMEM;
 	}
 
@@ -519,6 +524,7 @@
 		free((char *)(*query)->acf->name);
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return ENOMEM;
 	}
 



More information about the asterisk-commits mailing list