[cfe-dev] Annotating a realloc-equivalent?

Bruce Stephens bruce.r.stephens at gmail.com
Thu Apr 18 09:59:36 PDT 2013


We have a wrapper around malloc (that usually calls abort if malloc
fails). That's easy: I can just add
__attribute((ownership_returns(malloc,1))).

We also have a wrapper around realloc. How can I annotate that? I tried
__attribute((ownership_returns(malloc,2)))
__attribute((ownership_takes(malloc,1)))

but that gives the error Memory allocated by wrap_malloc() should be
deallocated by free(), not wrap_realloc().



More information about the cfe-dev mailing list