memleak: Fixed false negative for sample

This commit is contained in:
Daniel Marjamäki 2019-08-18 19:45:39 +02:00
parent b2e66a23e7
commit 474fed453e
2 changed files with 4 additions and 1 deletions

View File

@ -735,7 +735,7 @@ const Token * CheckLeakAutoVar::checkTokenInsideExpression(const Token * const t
deallocUseError(tok, tok->str());
} else if (Token::simpleMatch(tok->tokAt(-2), "= &")) {
varInfo->erase(tok->varId());
} else if (tok->strAt(-1) == "=") {
} else if (Token::Match(tok->previous(), "= %var% [;,)]")) {
varInfo->erase(tok->varId());
}
} else if (Token::Match(tok->previous(), "& %name% = %var% ;")) {

View File

@ -0,0 +1,3 @@
samples/memleak/bad.c:8:5: error: Memory leak: a [memleak]
return result;
^