[Freeswitch-svn] [commit] r4889 - freeswitch/trunk/src/mod/applications/mod_commands

Freeswitch SVN brian at freeswitch.org
Sat Apr 7 23:53:35 EDT 2007


Author: brian
Date: Sat Apr  7 23:53:35 2007
New Revision: 4889

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c

Log:
fix segfault thanks bblack

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Sat Apr  7 23:53:35 2007
@@ -27,6 +27,7 @@
  * Michael Jerris <mike at jerris.com>
  * Johny Kadarisman <jkr888 at gmail.com>
  * Paul Tinsley <jackhammer at gmail.com>
+ * Marcel Barbulescu <marcelbarbulescu at gmail.com>
  *
  * 
  * mod_commands.c -- Misc. Command Module
@@ -901,19 +902,21 @@
 	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])));
-	}	
-
-	cmd = argv[0];
-	if (argv[2] && !strcasecmp(argv[1], "as")) {
-		as = argv[2];
+	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];
+		}
 	}
 	
 	if (!as && stream->event) {



More information about the Freeswitch-svn mailing list