]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't leak db handle when called api command with session. Found by Klockwork (www...
authorMichael Jerris <mike@jerris.com>
Fri, 16 May 2008 18:50:14 +0000 (18:50 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 16 May 2008 18:50:14 +0000 (18:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8451 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index e453fbc691dcf7375475d871463252c476cdab69..dccf3da739b704a7923a8b33e0bd7be0d80bf182 100644 (file)
@@ -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];