memleak: Fixed false negative for sample
This commit is contained in:
parent
b2e66a23e7
commit
474fed453e
|
@ -735,7 +735,7 @@ const Token * CheckLeakAutoVar::checkTokenInsideExpression(const Token * const t
|
||||||
deallocUseError(tok, tok->str());
|
deallocUseError(tok, tok->str());
|
||||||
} else if (Token::simpleMatch(tok->tokAt(-2), "= &")) {
|
} else if (Token::simpleMatch(tok->tokAt(-2), "= &")) {
|
||||||
varInfo->erase(tok->varId());
|
varInfo->erase(tok->varId());
|
||||||
} else if (tok->strAt(-1) == "=") {
|
} else if (Token::Match(tok->previous(), "= %var% [;,)]")) {
|
||||||
varInfo->erase(tok->varId());
|
varInfo->erase(tok->varId());
|
||||||
}
|
}
|
||||||
} else if (Token::Match(tok->previous(), "& %name% = %var% ;")) {
|
} else if (Token::Match(tok->previous(), "& %name% = %var% ;")) {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
samples/memleak/bad.c:8:5: error: Memory leak: a [memleak]
|
||||||
|
return result;
|
||||||
|
^
|
Loading…
Reference in New Issue