From d7e28e3a28f9447fe87fb91cf6ed5659212cbc96 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Thu, 7 Aug 2014 21:08:31 +0400 Subject: [PATCH] Fixing memory leak in mem_pools_alloc. --- src/liballocator/mem-poolman.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/liballocator/mem-poolman.c b/src/liballocator/mem-poolman.c index d5a0b4f06..545ee31e7 100644 --- a/src/liballocator/mem-poolman.c +++ b/src/liballocator/mem-poolman.c @@ -179,12 +179,15 @@ mem_pools_alloc( mem_pool_chunk_type_t chunk_type) /**< chunk type */ MEM_HEAP_ALLOC_LONG_TERM); if ( pool_space == NULL ) - { + { /** - * Not enough memory. + * Not enough memory. Freeing pool header that was allocated above. */ + + mem_pool_free_chunk( &mem_pool_for_pool_headers, (uint8_t*) pool_state); + return NULL; - } + } mem_pool_init( pool_state, chunk_size,