Fixed #1301 (False positive: Data is allocated but not initialized)
This commit is contained in:
parent
aab05524e5
commit
43c8fe895c
|
@ -1910,6 +1910,8 @@ private:
|
||||||
{
|
{
|
||||||
if (!Token::Match(tok.previous(), "[;{}] %var% . %var% ="))
|
if (!Token::Match(tok.previous(), "[;{}] %var% . %var% ="))
|
||||||
use_pointer(foundError, checks, &tok);
|
use_pointer(foundError, checks, &tok);
|
||||||
|
else
|
||||||
|
bailOutVar(checks, tok.varId());
|
||||||
return &tok;
|
return &tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1606,6 +1606,14 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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"
|
checkUninitVar("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" ABC *abc = malloc(100);\n"
|
" ABC *abc = malloc(100);\n"
|
||||||
|
|
Loading…
Reference in New Issue