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

This commit is contained in:
Daniel Marjamäki 2009-12-27 17:35:18 +01:00
parent 738987a686
commit 1c0f3ee179
2 changed files with 9 additions and 1 deletions

View File

@ -1664,7 +1664,8 @@ private:
if (Token::simpleMatch(tok.next(), "."))
{
use_pointer(foundError, checks, &tok);
if (!Token::Match(tok.previous(), "[;{}] %var% . %var% ="))
use_pointer(foundError, checks, &tok);
return &tok;
}

View File

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