From: Paul Harris Date: Sun, 3 Jun 2012 18:17:29 +0000 (+0800) Subject: Bugfix: must cast void* to do pointer math X-Git-Tag: v2.4-moonshot~1^2~10^2~2 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=commitdiff_plain;h=f62b1f5d696a196a4fe97b52da7cc9777e648ab0 Bugfix: must cast void* to do pointer math Fixes #78. --- 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);