r178388 - [analyzer] Enabled unix.Malloc checker.
Jordan Rose
jordan_rose at apple.com
Fri Mar 29 17:59:04 PDT 2013
On Mar 29, 2013, at 17:50 , Anton Yartsev <anton.yartsev at gmail.com> wrote:
> +//----- Test free standard new
> +void testFreeOpNew() {
> + void *p = operator new(0);
> + free(p);
> +} // expected-warning{{Memory is never released; potential leak}}
> +// FIXME: Pointer should escape
> +
> +void testFreeNewExpr() {
> + int *p = new int;
> + free(p);
> +} // expected-warning{{Memory is never released; potential leak}}
> +// FIXME: Pointer should escape
> +
> +void testObjcFreeNewed() {
> + int *p = new int;
> + NSData *nsdata = [NSData dataWithBytesNoCopy:p length:sizeof(int) freeWhenDone:1]; // expected-warning{{Memory is never released; potential leak}}
> +}
> +// FIXME: Pointer should escape
These don't escape because we assume arbitrary system functions don't free memory. I think these are fine when unix.Malloc is disabled.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130329/a303d19b/attachment.html>
More information about the cfe-commits
mailing list