Revision
16051
Author
mrene
Date
2009-12-23 22:29:16 -0600 (Wed, 23 Dec 2009)

Log Message

Avoiding segfault

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (16050 => 16051)


--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-12-24 00:51:46 UTC (rev 16050)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	2009-12-24 04:29:16 UTC (rev 16051)
@@ -288,8 +288,8 @@
 					const char *x_user_type = switch_xml_attr_soft(x_user, "type");
 					const char *dest = NULL;
 					char *d_dest = NULL;
-					switch_xml_t xml_for_pointer, x_domain_for_pointer, x_group_for_pointer, x_user_for_pointer;
-					static switch_call_cause_t cause = SWITCH_CAUSE_NONE;
+					switch_xml_t xml_for_pointer = NULL, x_domain_for_pointer = NULL, x_group_for_pointer = NULL, x_user_for_pointer = NULL;
+					switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 
 					my_x_user = x_user;
 
@@ -381,9 +381,10 @@
 					}
 
   				done_x_user:
-
-        				switch_xml_free(xml_for_pointer);
-					xml_for_pointer = NULL;
+					if (xml_for_pointer) {
+	        				switch_xml_free(xml_for_pointer);
+						xml_for_pointer = NULL;
+					}
 				}
 
 				if (ok && dstream.data) {