[llvm-bugs] [Bug 36290] New: False memory leak report involving self-deleting object

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 7 20:49:11 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36290

            Bug ID: 36290
           Summary: False memory leak report involving self-deleting
                    object
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: jakob.leben at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19836
  --> https://bugs.llvm.org/attachment.cgi?id=19836&action=edit
Example code that generates false memory leak report

The attached example reports a potential memory leak:

$ scan-build-6.0 clang++-6.0 -std=c++14 example.cpp

example.cpp:19:1: warning: Potential leak of memory pointed to by 'p'
}
^

I believe there is no memory leak in this example though.

The example exhibits a pattern sometimes used in smart pointer implementations,
such as Poco::AutoPtr:
https://pocoproject.org/docs/Poco.AutoPtr.html

I believe the same issue in the static analyzer causes memory leak and
null-pointer dereference warnings when using Poco::AutoPtr.

-- 
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/20180208/25e29169/attachment.html>


More information about the llvm-bugs mailing list