[asterisk-addons-commits] tilghman: branch 1.2 r357 - /branches/1.2/res_config_mysql.c

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Mon Apr 9 13:39:45 MST 2007


Author: tilghman
Date: Mon Apr  9 15:39:45 2007
New Revision: 357

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=357
Log:
Fix memory leaks, and some unnecessary closes

Modified:
    branches/1.2/res_config_mysql.c

Modified: branches/1.2/res_config_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.2/res_config_mysql.c?view=diff&rev=357&r1=356&r2=357
==============================================================================
--- branches/1.2/res_config_mysql.c (original)
+++ branches/1.2/res_config_mysql.c Mon Apr  9 15:39:45 2007
@@ -108,7 +108,6 @@
 	newval = va_arg(ap, const char *);
 	if(!newparam || !newval)  {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
-		mysql_close(&mysql);
 		return NULL;
 	}
 
@@ -218,7 +217,7 @@
 	newval = va_arg(ap, const char *);
 	if(!newparam || !newval)  {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
-		mysql_close(&mysql);
+		ast_config_destroy(cfg);
 		return NULL;
 	}
 
@@ -266,6 +265,7 @@
 		ast_log(LOG_DEBUG, "MySQL RealTime: Query: %s\n", sql);
 		ast_log(LOG_DEBUG, "MySQL RealTime: Query Failed because: %s\n", mysql_error(&mysql));
 		ast_mutex_unlock(&mysql_lock);
+		ast_config_destroy(cfg);
 		return NULL;
 	}
 
@@ -323,7 +323,6 @@
 	newval = va_arg(ap, const char *);
 	if(!newparam || !newval)  {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
-		mysql_close(&mysql);
                return -1;
 	}
 



More information about the asterisk-addons-commits mailing list