1 parent f25e935 commit 7ae750bCopy full SHA for 7ae750b
1 file changed
lib/checkother.cpp
@@ -2854,7 +2854,9 @@ void CheckOtherImpl::checkInvalidFree()
2854
if (std::any_of(op->values().cbegin(),
2855
op->values().cend(),
2856
[&](const ValueFlow::Value &value) {
2857
- return value.isSymbolicValue() && value.intvalue == 0;
+ if (!value.isSymbolicValue() || !value.isKnown() || value.intvalue != 0 || !value.tokvalue)
2858
+ return false;
2859
+ return value.tokvalue->str() == "new";
2860
}))
2861
continue;
2862
const int var1 = tok->tokAt(varIndex)->varId();
0 commit comments