Fixing memory leak in mem_pools_alloc.

This commit is contained in:
Ruben Ayrapetyan
2014-08-07 21:08:31 +04:00
parent 2887332573
commit d7e28e3a28
+6 -3
View File
@@ -179,12 +179,15 @@ mem_pools_alloc( mem_pool_chunk_type_t chunk_type) /**< chunk type */
MEM_HEAP_ALLOC_LONG_TERM); MEM_HEAP_ALLOC_LONG_TERM);
if ( pool_space == NULL ) 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; return NULL;
} }
mem_pool_init( pool_state, mem_pool_init( pool_state,
chunk_size, chunk_size,