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: dcough...@apple.com
          Reporter: jakob.le...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to