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