From 7c50dc16915f51d517dc3e84208525c832b8b097 Mon Sep 17 00:00:00 2001 From: Geoff Gustafson Date: Mon, 29 Aug 2016 03:20:13 -0700 Subject: [PATCH] Assert that pointer passed to jmem_pools_free is not NULL If a NULL pointer is passed here, the list of free chunks gets lost. JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com --- jerry-core/jmem/jmem-poolman.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jerry-core/jmem/jmem-poolman.c b/jerry-core/jmem/jmem-poolman.c index 0c1ed8c71..6170da079 100644 --- a/jerry-core/jmem/jmem-poolman.c +++ b/jerry-core/jmem/jmem-poolman.c @@ -131,6 +131,8 @@ jmem_pools_alloc (void) void __attribute__((hot)) jmem_pools_free (void *chunk_p) /**< pointer to the chunk */ { + JERRY_ASSERT (chunk_p != NULL); + jmem_pools_chunk_t *const chunk_to_free_p = (jmem_pools_chunk_t *) chunk_p; VALGRIND_DEFINED_SPACE (chunk_to_free_p, JMEM_POOL_CHUNK_SIZE);