[Cbe-oss-dev] [PATCH 12/23]MARS/base: free null fix

Yuji Mano yuji.mano at am.sony.com
Sat Mar 14 12:18:41 EST 2009


From: Kazunori Asayama <asayama at sm.sony.co.jp>

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 at sm.sony.co.jp>
---
 base/src/host/lib/ea_cell.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/base/src/host/lib/ea_cell.c
===================================================================
--- a/base/src/host/lib/ea_cell.c	2009-02-12 22:30:42.000000000 +0900
+++ b/base/src/host/lib/ea_cell.c	2009-03-03 20:00:10.000000000 +0900
@@ -86,7 +86,8 @@ static void numa_ea_free(uint64_t ea)
 	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 */






More information about the cbe-oss-dev mailing list