]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix leak and make static or dynamic head obj possible
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 15 Dec 2009 19:26:58 +0000 (19:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 15 Dec 2009 19:26:58 +0000 (19:26 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15972 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/switch_console.c

index 6876e3c396065cf68b0c0ef6015d10fbdd0ff36b..2659355cdd65318bc899f730d2afb40e217cb3c0 100644 (file)
@@ -1494,7 +1494,7 @@ typedef struct switch_console_callback_match_node switch_console_callback_match_
 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;
 
index 4b83ee943d74f3735decd0e1334a0b1cc0fa95ad..3c5bfff13afadfa63cbea81e5be9d82a7eea07bd 100644 (file)
@@ -1125,6 +1125,10 @@ SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t
                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 @@ SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t *
 
        if (!*matches) {
                switch_zmalloc(*matches, sizeof(**matches));
+               (*matches)->dynamic = 1;
        }
 
        switch_zmalloc(match, sizeof(*match));