Fixed #1472 (false positive: Data is allocated but not initialized: service)

This commit is contained in:
Daniel Marjamäki 2010-03-07 09:08:52 +01:00
parent b88126a669
commit 7f42ed3ad0
2 changed files with 11 additions and 1 deletions

View File

@ -2154,7 +2154,10 @@ private:
if (Token::simpleMatch(tok.next(), ".")) if (Token::simpleMatch(tok.next(), "."))
{ {
if (!Token::Match(tok.previous(), "[;{}] %var% . %var% =")) const Token *tok2 = tok.next();
while (Token::Match(tok2, ". %var%"))
tok2 = tok2->tokAt(2);
if (tok2 && tok2->str() != "=")
use_pointer(foundError, checks, &tok); use_pointer(foundError, checks, &tok);
else else
bailOutVar(checks, tok.varId()); bailOutVar(checks, tok.varId());

View File

@ -1647,6 +1647,13 @@ private:
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo()\n"
"{\n"
" ABC *abc = malloc(100);\n"
" abc->a.word = 123;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo()\n" checkUninitVar("void foo()\n"
"{\n" "{\n"
" ABC *abc = malloc(100);\n" " ABC *abc = malloc(100);\n"