[cfe-dev] Annotating a realloc-equivalent?

Jordan Rose jordan_rose at apple.com
Thu Apr 18 15:22:06 PDT 2013

Interesting. I don't think we've ever tried to stack ownership attributes, but this makes plenty of sense. Please file a bug with a standalone test case, though I can't promise we'll get to it any time soon. Meanwhile, you can disable the "unix.MismatchedDeallocator" checker until this is fixed.

(CCing Anton, who wrote most of unix.MismatchedDeallocator)

On Apr 18, 2013, at 9:59 , Bruce Stephens <bruce.r.stephens at gmail.com> wrote:

> 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().
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130418/118ca3e5/attachment.html>

More information about the cfe-dev mailing list