This gcc code:
void* d __attribute__((cleanup(free))) = malloc(size);
gives this error:
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,
void *d = malloc(size);
Which makes me think this is a gcc error
I can't find a simple pragma to disable this check; this fails:
#pragma GCC diagnostic ignored "-Wno-free-nonheap-object"