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.
This commit is contained in:
parent
09f58c0984
commit
9c77ad1889
1 changed files with 2 additions and 2 deletions
|
@ -370,7 +370,7 @@ void * os_realloc(void *ptr, size_t size)
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return os_malloc(size);
|
return os_malloc(size);
|
||||||
|
|
||||||
a = ptr - sizeof(*a);
|
a = (struct os_alloc_trace *) ptr - 1;
|
||||||
if (a->magic != ALLOC_MAGIC) {
|
if (a->magic != ALLOC_MAGIC) {
|
||||||
wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
|
wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
|
||||||
a, a->magic,
|
a, a->magic,
|
||||||
|
@ -396,7 +396,7 @@ void os_free(void *ptr)
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
a = ptr - sizeof(*a);
|
a = (struct os_alloc_trace *) ptr - 1;
|
||||||
if (a->magic != ALLOC_MAGIC) {
|
if (a->magic != ALLOC_MAGIC) {
|
||||||
wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
|
wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
|
||||||
a, a->magic,
|
a, a->magic,
|
||||||
|
|
Loading…
Reference in a new issue