From: Michael Jerris Date: Fri, 16 May 2008 18:50:14 +0000 (+0000) Subject: don't leak db handle when called api command with session. Found by Klockwork (www... X-Git-Tag: v1.0-rc6~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5418702cda7773139f663789ea09f5d8835d8935;p=thirdparty%2Ffreeswitch.git don't leak db handle when called api command with session. Found by Klockwork (www.klocwork.com) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8451 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index e453fbc691..dccf3da739 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1921,7 +1921,7 @@ SWITCH_STANDARD_API(show_function) { 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 @@ SWITCH_STANDARD_API(show_function) 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];