Fixed false positive #6466

This commit is contained in:
PKEuS 2015-01-29 09:50:33 +01:00
parent 0c89afcc48
commit 9ada111045
2 changed files with 8 additions and 1 deletions

View File

@ -412,7 +412,7 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
tok = tok->next();
while (Token::Match(tok, "%var% ::|."))
tok = tok->tokAt(2);
if (tok->varId()) {
if (tok->varId() && tok->strAt(1) != "[") {
VarInfo::AllocInfo allocation(-1, VarInfo::DEALLOC);
changeAllocStatus(varInfo, allocation, tok, tok);
}

View File

@ -473,6 +473,13 @@ private:
"}", true);
ASSERT_EQUALS("", errout.str());
check(
"void foo(char **p) {\n"
" delete p[0];\n"
" delete p[1];\n"
"}", true);
ASSERT_EQUALS("", errout.str());
check(
"void foo(char *p) {\n"
" delete p;\n"