[LLVMbugs] [Bug 14856] New: IPA notices leak that isn't noticed in normal method

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 8 14:15:28 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=14856

             Bug #: 14856
           Summary: IPA notices leak that isn't noticed in normal method
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9837
  --> http://llvm.org/bugs/attachment.cgi?id=9837
example

See the attached sample which adds hex reading to NSData.

In the error case, the -initWithHexString:error: returns nil without calling
[self release], thus leaking the receiver.

But, clang-sa only warns when building the +dataWithHexString:error: cover
method:


hex-string.m:28:14: warning: Potential leak of an object stored into 'self'
    return [[[self alloc] initWithHexString:hexString error:outError]
autorelease];
             ^
1 warning generated.

It should actually warn right before the 'goto cleanup' since that is where the
leak happens. Without this, it is much harder to track down why clang-sa thinks
there is a leak.

-- 
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