[llvm-bugs] [Bug 33694] New: False positive reported by static analyzer: "Potential memory leak"
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 5 13:27:30 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33694
Bug ID: 33694
Summary: False positive reported by static analyzer:
"Potential memory leak"
Product: clang
Version: 2.7
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: jaf at meyersound.com
CC: llvm-bugs at lists.llvm.org
Created attachment 18754
--> https://bugs.llvm.org/attachment.cgi?id=18754&action=edit
Self-contained example program that reproduces the false-positive when you
compile it using scan-build
Hi all,
When I run the attached trivial example program through clang's scan-build
utility, I get a warning message that I believe is a false positive:
$ scan-build g++ bogus_memory_leak_warning.cpp
scan-build: Using '/Users/jaf/checker-279/bin/clang' for static analysis
bogus_memory_leak_warning.cpp:26:4: warning: Potential memory leak
}
^
1 warning generated.
scan-build: 1 bug found.
scan-build: Run 'scan-view
/var/folders/1x/wkkcw0xx6dl54r2326vk0lh80000gn/T/scan-build-2017-07-05-132302-32588-1'
to examine bug reports.
AFAICT the code in the trivial example program doesn't have any actual memory
leaks, but SA thinks that it does. (If I'm wrong about that, I apologize).
Also note that if I comment out line 25 in the attached file, the
false-positive warning goes away; however I think the presence of that line
should not make any difference regarding whether the program has a memory leak
or not.
(This example application is just a minimal self-contained example, of course;
the actual codebase where I see this sort of false positive pop up is much
larger, but this example is easier to understand and debug)
-Jeremy
--
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/20170705/5ebc9974/attachment.html>
More information about the llvm-bugs
mailing list