From: Brian West Date: Sun, 8 Apr 2007 03:53:35 +0000 (+0000) Subject: fix segfault thanks bblack X-Git-Tag: v1.0-beta1~564 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bb347ddfd1d768b3fcef2e977185e5ba09e7439;p=thirdparty%2Ffreeswitch.git fix segfault thanks bblack git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4889 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 80a9c7c542..411e9a96dd 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -27,6 +27,7 @@ * Michael Jerris * Johny Kadarisman * Paul Tinsley + * Marcel Barbulescu * * * mod_commands.c -- Misc. Command Module @@ -901,19 +902,21 @@ static switch_status_t show_function(char *data, switch_core_session_t *session, int help = 0; char *mydata, *argv[5] = {0}; int argc; - char *cmd, *as = NULL; + char *cmd = NULL, *as = NULL; if (session) { return SWITCH_STATUS_FALSE; } - if ((mydata = strdup(data))) { - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } + if (data) { + if ((mydata = strdup(data))) { + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } - cmd = argv[0]; - if (argv[2] && !strcasecmp(argv[1], "as")) { - as = argv[2]; + cmd = argv[0]; + if (argv[2] && !strcasecmp(argv[1], "as")) { + as = argv[2]; + } } if (!as && stream->event) {