Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf)
This commit is contained in:
parent
be35b72c7e
commit
7c52c8683d
|
@ -2965,7 +2965,7 @@ private:
|
||||||
for (std::list<const Token *>::const_iterator it = var2.begin(); it != var2.end(); ++it)
|
for (std::list<const Token *>::const_iterator it = var2.begin(); it != var2.end(); ++it)
|
||||||
{
|
{
|
||||||
if (std::find(var.begin(), var.end(), *it) == var.end())
|
if (std::find(var.begin(), var.end(), *it) == var.end())
|
||||||
use_pointer(checks, *it);
|
use_dead_pointer(checks, *it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2022,6 +2022,13 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: p\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: p\n", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void foo(const char *s)\n"
|
||||||
|
"{\n"
|
||||||
|
" char *p = malloc(100);\n"
|
||||||
|
" memcpy(p, s, 100);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// using uninitialized function pointer..
|
// using uninitialized function pointer..
|
||||||
checkUninitVar("void foo()\n"
|
checkUninitVar("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue