Hi,
The following code exhibit the problem
int* df(int* expr); int * level() { std::unique_ptr<int> fixedLeg; fixedLeg.reset(df(fixedLeg.release())); if (!fixedLeg) return nullptr; return fixedLeg.release(); }
library_release.cpp:7:9: style: Condition '!fixedLeg' is always true [knownConditionTrueFalse] if (!fixedLeg)
If on line 6, I replace release() by get(), I receive no warning
int* df(int* expr); int * level() { std::unique_ptr<int> fixedLeg; fixedLeg.reset(df(fixedLeg.get())); if (!fixedLeg) return nullptr; return fixedLeg.release(); }
False positive with cppcheck 2.0 and 2.1
Thanks! I can reproduce. I created https://trac.cppcheck.net/ticket/9777
Log in to post a comment.
Hi,
The following code exhibit the problem
library_release.cpp:7:9: style: Condition '!fixedLeg' is always true [knownConditionTrueFalse]
if (!fixedLeg)
If on line 6, I replace release() by get(), I receive no warning
False positive with cppcheck 2.0 and 2.1
Thanks! I can reproduce. I created https://trac.cppcheck.net/ticket/9777