https://bugs.llvm.org/show_bug.cgi?id=44050
Bug ID: 44050
Summary: clang-analyzer-cplusplus.NewDelete false-positive -
does not note nullification of ptr after delete
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
This is manually reduced from a report that i got via CTU mode (yay).
The issue appears to be false-positive:
struct S {
int *storage;
~S() {
if(!storage)
return;
delete storage; // <- we can't
storage = nullptr;
}
};
S producer();
S foo() {
S imm = producer();
return imm;
}
S bar() {
S imm = foo();
return imm;
}
warning: Attempt to free released memory [clang-analyzer-cplusplus.NewDelete]
delete storage;
^
But how can that happen, after deleting we set it to nullptr?
https://godbolt.org/z/Jkusgy
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs