projects
/
profile
/
ivi
/
jansson.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2b87fdc
)
Bugfix: must cast void* to do pointer math
author
Paul Harris
<paulharris@computer.org>
Sun, 3 Jun 2012 18:17:29 +0000
(
02:17
+0800)
committer
Petri Lehtinen
<petri@digip.org>
Wed, 6 Jun 2012 18:09:47 +0000
(21:09 +0300)
Fixes #78.
test/suites/api/test_memory_funcs.c
patch
|
blob
|
history
diff --git
a/test/suites/api/test_memory_funcs.c
b/test/suites/api/test_memory_funcs.c
index
ed18ded
..
4d6a81e
100644
(file)
--- 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);