http://llvm.org/bugs/show_bug.cgi?id=13140
Bug #: 13140
Summary: static analyzer false positive: reports leak from
malloc & NSPointerArray combination
Product: new-bugs
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
With the code below, clang version 3.2 (trunk 158669) reports:
$ clang --analyze test.m
test.m:14:50: warning: Memory is never released; potential leak of memory
pointed to by 'foobar'
Code:
NSPointerFunctionsOptions options = NSPointerFunctionsOpaqueMemory |
NSPointerFunctionsOpaquePersonality;
NSPointerArray* pointerArray = [NSPointerArray
pointerArrayWithOptions:options];
void* foobar = malloc (1024);
if (foobar)
{
[pointerArray addPointer:foobar];
}
void* buffer = [pointerArray pointerAtIndex:0];
free(buffer);
The analyzer claims "foobar" is leaked. I can see why it would think that, but
perhaps it could be taught about NSPointerArray?
(This contrived test case is of course reduced from real code.)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs