aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasashi Honma <honma@ictec.co.jp>2010-08-26 15:35:55 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-05 14:33:21 (GMT)
commite28f7f44f37f841ca119c8c68a8666e4b2f0afff (patch)
treeed60af2c297598990bc1ae0a7c2b449c593d4ad1
parentd0e8c4a0f5ebba2d694e761b580f3c3d2111cf5b (diff)
downloadhostap-07-e28f7f44f37f841ca119c8c68a8666e4b2f0afff.zip
hostap-07-e28f7f44f37f841ca119c8c68a8666e4b2f0afff.tar.gz
hostap-07-e28f7f44f37f841ca119c8c68a8666e4b2f0afff.tar.bz2
trace: Fix void pointer arithmetic
The arithmetic on void pointer exists in trace routine. On GNU C, it works because void pointer size is 1, but not all compilers behave like this. So this patch specifies the size of the pointer. (cherry picked from commit 9c77ad1889664f85f03ea13b629f3107189fe0cc)
-rw-r--r--src/utils/os_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c
index cb23f72..6f58fa4 100644
--- a/src/utils/os_unix.c
+++ b/src/utils/os_unix.c
@@ -370,7 +370,7 @@ void * os_realloc(void *ptr, size_t size)
if (ptr == NULL)
return os_malloc(size);
- a = ptr - sizeof(*a);
+ a = (struct os_alloc_trace *) ptr - 1;
if (a->magic != ALLOC_MAGIC) {
wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
a, a->magic,
@@ -396,7 +396,7 @@ void os_free(void *ptr)
if (ptr == NULL)
return;
- a = ptr - sizeof(*a);
+ a = (struct os_alloc_trace *) ptr - 1;
if (a->magic != ALLOC_MAGIC) {
wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
a, a->magic,