[Freeswitch-svn] [commit] r8451 - freeswitch/trunk/src/mod/applications/mod_commands

Freeswitch SVN mikej at freeswitch.org
Fri May 16 14:50:14 EDT 2008


Author: mikej
Date: Fri May 16 14:50:14 2008
New Revision: 8451

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c

Log:
don't leak db handle when called api command with session. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Fri May 16 14:50:14 2008
@@ -1921,7 +1921,7 @@
 {
 	char sql[1024];
 	char *errmsg;
-	switch_core_db_t *db = switch_core_db_handle();
+	switch_core_db_t *db;
 	struct holder holder = { 0 };
 	int help = 0;
 	char *mydata = NULL, *argv[6] = {0};
@@ -1933,6 +1933,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	db = switch_core_db_handle();
+
 	if (cmd && (mydata = strdup(cmd))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 		command = argv[0];



More information about the Freeswitch-svn mailing list