]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Track who calls memory pool destroy. 473/head
authorAndrey Volk <andywolk@gmail.com>
Thu, 5 Mar 2020 18:58:12 +0000 (22:58 +0400)
committerAndrey Volk <andywolk@gmail.com>
Thu, 5 Mar 2020 19:55:03 +0000 (23:55 +0400)
src/switch_core_memory.c
src/switch_scheduler.c

index eb35f1b2ca5914e1e790d508eefc7146bf56e61e..2cf007fad2ccad5644387f5bd45c8352c2a67891 100644 (file)
@@ -463,7 +463,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
 
 SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line)
 {
+       char *tmp;
+       const char *tag;
        switch_assert(pool != NULL);
+       
+       /* In tag we store who calls the pool creation.
+          Now we append it with who calls the pool destroy.
+       */
+       if (*pool) {
+               tag = apr_pool_tag(*pool, NULL);
+               tmp = switch_core_sprintf(*pool, "%s,%s:%d", (tag ? tag : ""), file, line);
+               apr_pool_tag(*pool, tmp);
+       }
 
 #ifdef DEBUG_ALLOC2
        switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL));
index 6452fa9cc242663ac57a7fc6cf8ec0d663a40b18..c08d1071b4de90fe1ac1133be924484fe6c30bf2 100644 (file)
@@ -54,7 +54,7 @@ static struct {
        int task_thread_running;
        switch_queue_t *event_queue;
        switch_memory_pool_t *memory_pool;
-} globals;
+} globals = { 0 };
 
 static void switch_scheduler_execute(switch_scheduler_task_container_t *tp)
 {