[LLVMbugs] [Bug 15846] New: False positive "potential leak of an object" with wrapper reset method

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 25 16:15:41 PDT 2013


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

            Bug ID: 15846
           Summary: False positive "potential leak of an object" with
                    wrapper reset method
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: bugzilla at jwwalker.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10427
  --> http://llvm.org/bugs/attachment.cgi?id=10427&action=edit
RetainCountFalsePositive.cpp

Overview:

When using a wrapper class that holds a reference-counted Core Foundation
object, the static analyzer reports a potential leak whenever I have the
wrapper take ownership of an object.


Steps to reproduce:

Analyze the attached Mac C++ source file.


Actual results:

"Potential leak of an object" warning.


Expected results:

No warnings.


Build date:

clang version 3.3 (trunk 180561) (llvm/trunk 180467)
Target: x86_64-apple-darwin11.4.2
Thread model: posix


Additional Information:

If I comment out the line "if (ptr_ != p)" in the Reset method, the warning
goes away.  I guess the analyzer is "thinking" that the test might fail, so p
might not be assigned to ptr_.  But I can't see any way that
CFStringCreateWithCString could return a pointer that is already in the ptr_
member.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130425/0ca69c1d/attachment.html>


More information about the llvm-bugs mailing list