-
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
This is heavily WIP as sometimes we have to release a new after we return it or a constructor did something with that. The direction is okay?
Comment Actions
In such cases i recommend starting with writing down a test. Like in TDD: first test, then code.
The general direction doesn't seem reasonable to me; it introduces some pattern-matching for a specific scenario, but it's unclear why is this scenario a problem on its own. We might eventually do something similar, but I recommend fully debugging the false positive - i.e., understanding what exactly is wrong with it, before picking a suppression mechanism.
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
1119–1122 | I think it's clearly too early for marking the pointer as released. I.e., what about: auto x = std::shared_ptr(new int); // the pointer is marked as released use(x.get()); // use-after-free??? |
I think it's clearly too early for marking the pointer as released. I.e., what about: