Revision
15972
Author
anthm
Date
2009-12-15 13:26:58 -0600 (Tue, 15 Dec 2009)

Log Message

fix leak and make static or dynamic head obj possible

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/switch_types.h (15971 => 15972)


--- freeswitch/trunk/src/include/switch_types.h	2009-12-15 19:22:57 UTC (rev 15971)
+++ freeswitch/trunk/src/include/switch_types.h	2009-12-15 19:26:58 UTC (rev 15972)
@@ -1494,7 +1494,7 @@
 struct switch_console_callback_match {
 	struct switch_console_callback_match_node *head;
 	struct switch_console_callback_match_node *end;
-	switch_memory_pool_t *pool;
+	int dynamic;
 };
 typedef struct switch_console_callback_match switch_console_callback_match_t;
 

Modified: freeswitch/trunk/src/switch_console.c (15971 => 15972)


--- freeswitch/trunk/src/switch_console.c	2009-12-15 19:22:57 UTC (rev 15971)
+++ freeswitch/trunk/src/switch_console.c	2009-12-15 19:26:58 UTC (rev 15972)
@@ -1125,6 +1125,10 @@
 		free(cur->val);
 		free(cur);
 	}
+
+	if (my_match->dynamic) {
+		free(my_match);
+	}
 }
 
 SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val)
@@ -1133,6 +1137,7 @@
 
 	if (!*matches) {
 		switch_zmalloc(*matches, sizeof(**matches));
+		(*matches)->dynamic = 1;
 	}
 
 	switch_zmalloc(match, sizeof(*match));