]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix size overflow in pool_stats (when configured with --enable-pool-debug)
authorAndrey Volk <andywolk@gmail.com>
Tue, 9 Jun 2020 11:27:00 +0000 (15:27 +0400)
committerAndrey Volk <andywolk@gmail.com>
Fri, 12 Jun 2020 15:35:03 +0000 (19:35 +0400)
src/switch_core_memory.c

index 2cf007fad2ccad5644387f5bd45c8352c2a67891..86b54ce02e7a6d2d9243b0730a3266609a98bd37 100644 (file)
@@ -356,7 +356,7 @@ SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
 #if APR_POOL_DEBUG
 static int switch_core_pool_stats_callback(apr_pool_t *pool, void *data) {
        switch_stream_handle_t *stream = (switch_stream_handle_t *)data;
-       unsigned int size = (unsigned int)apr_pool_num_bytes(pool, 1);
+       size_t size = (size_t)apr_pool_num_bytes(pool, 1);
        unsigned int alloc = 0, total_alloc = 0, clear = 0;
        char *line = NULL;
 
@@ -364,9 +364,9 @@ static int switch_core_pool_stats_callback(apr_pool_t *pool, void *data) {
        apr_pool_get_stats(pool, &alloc, &total_alloc, &clear);
 
        if (stream) {
-               stream->write_function(stream, "Pool '%s' size: %d, alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), (int)size, alloc, total_alloc, clear);
+               stream->write_function(stream, "Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
        } else {
-               printf("Pool '%s' size: %d, alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), (int)size, alloc, total_alloc, clear);
+               printf("Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
        }
        return 0;
 }