Created attachment 19836
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.
example.cpp
(203 bytes, text/x-c++src)