Revision
16029
Author
mrene
Date
2009-12-22 15:44:46 -0600 (Tue, 22 Dec 2009)

Log Message

mod_commands: check for zstr(cmd) in escape_function

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (16028 => 16029)


--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-12-22 21:39:02 UTC (rev 16028)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-12-22 21:44:46 UTC (rev 16029)
@@ -3866,9 +3866,16 @@
 
 SWITCH_STANDARD_API(escape_function)
 {
-	int len = strlen(cmd)*2;
-	char *mycmd = malloc(strlen(cmd)*2);
+	int len;
+	char *mycmd;
 	
+	if (zstr(cmd)) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+	
+	len = strlen(cmd)*2;
+	mycmd = malloc(len);
+	
 	stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len));
 	
 	switch_safe_free(mycmd);