This gcc code:
Code:
void* d __attribute__((cleanup(free))) = malloc(size);
gives this error:
Code:
attempt to free a non-heap object ‘d’ [-Werror]
It seems like d is a heap object, so is the error with me or gcc 4.6.3?
This works however,
Code:
void *d = malloc(size);
free(d);
Which makes me think this is a gcc error
I can't find a simple pragma to disable this check; this fails:
Code:
#pragma GCC diagnostic ignored "-Wno-free-nonheap-object"