[LLVMbugs] [Bug 13140] New: static analyzer false positive: reports leak from malloc & NSPointerArray combination
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 18 12:08:21 PDT 2012
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: unassignedbugs at nondot.org
ReportedBy: sean at rogue-research.com
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list