From f62b1f5d696a196a4fe97b52da7cc9777e648ab0 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Mon, 4 Jun 2012 02:17:29 +0800 Subject: [PATCH] Bugfix: must cast void* to do pointer math Fixes #78. --- test/suites/api/test_memory_funcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/suites/api/test_memory_funcs.c b/test/suites/api/test_memory_funcs.c index ed18ded..4d6a81e 100644 --- a/test/suites/api/test_memory_funcs.c +++ b/test/suites/api/test_memory_funcs.c @@ -55,14 +55,14 @@ static void *secure_malloc(size_t size) /* Store the memory area size in the beginning of the block */ void *ptr = malloc(size + 8); *((size_t *)ptr) = size; - return ptr + 8; + return (char *)ptr + 8; } static void secure_free(void *ptr) { size_t size; - ptr -= 8; + ptr = (char *)ptr - 8; size = *((size_t *)ptr); /*guaranteed_*/memset(ptr, 0, size); -- 2.1.4