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
This commit is contained in:
Michael Jerris 2008-05-16 18:50:14 +00:00
parent 2d14539e47
commit 5418702cda
1 changed files with 3 additions and 1 deletions

View 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];