[cfe-dev] RFC: static analysis, malloc annontation for return via pointer argument

Ted Kremenek kremenek at apple.com
Tue Dec 18 11:33:05 PST 2012


Hi Scott,

I've thought about this patch some more, and I have some questions.  What are the intended semantics of this attribute?  With the other attributes its clearer.  If a function is annotated as returning an owned pointer, it's clear that if it is non-NULL then it is an owned pointer.  But what's the case here?  Can a function decide not to return a value at all (e.g., on failure)?  How would that be captured by the attribute?

Thanks,
Ted

On Dec 17, 2012, at 1:55 PM, Scott Parlane <scott at scottnz.com> wrote:

> Hi All,
> 
> This patch allows for APIs were memory is allocated and placed in a
> pointer given to them. (like asprintf, but without the realloc feature)
> 
> Currently, when using a pointer to a stack variable as the input to the
> function, it declares the memory leak on the next source line after the
> stack variable is used. I think it should be declaring the leak on the
> last line of the current scope. Which is correct ?
> 
> Regards,
> Scott
> <0001-Make-clang-static-analysis-support-allocation-into-a.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list