Fixed #1472 (false positive: Data is allocated but not initialized: service)
This commit is contained in:
parent
b88126a669
commit
7f42ed3ad0
|
@ -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());
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue