Fixed #1301 (False positive: Data is allocated but not initialized)

This commit is contained in:
Daniel Marjamäki 2010-01-23 21:25:17 +01:00
parent aab05524e5
commit 43c8fe895c
2 changed files with 10 additions and 0 deletions

View File

@ -1910,6 +1910,8 @@ private:
{
if (!Token::Match(tok.previous(), "[;{}] %var% . %var% ="))
use_pointer(foundError, checks, &tok);
else
bailOutVar(checks, tok.varId());
return &tok;
}

View File

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