base: Free null fix
Fix invalid memory access when passing NULL to mars_ea_free
This patch fixes invalid memorry access when calling mars_ea_free with
NULL pointer by checking if NULL or not.
Signed-off-by: Kazunori Asayama <asayama@sm.sony.co.jp>
Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
diff --git a/base/src/host/lib/ea_cell.c b/base/src/host/lib/ea_cell.c
index e61aca2..ff8f072 100644
--- a/base/src/host/lib/ea_cell.c
+++ b/base/src/host/lib/ea_cell.c
@@ -86,7 +86,8 @@
void *ptr = mars_ea_to_ptr(ea);
union mars_numa_ea_block *block = ptr - sizeof(*block);
- numa_free(block->info.top, block->info.size);
+ if (ptr)
+ numa_free(block->info.top, block->info.size);
}
#else /* ! MARS_ENABLE_NUMA */