Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf)

This commit is contained in:
Daniel Marjamäki 2010-05-09 07:48:52 +02:00
parent be35b72c7e
commit 7c52c8683d
2 changed files with 8 additions and 1 deletions

View File

@ -2965,7 +2965,7 @@ private:
for (std::list<const Token *>::const_iterator it = var2.begin(); it != var2.end(); ++it)
{
if (std::find(var.begin(), var.end(), *it) == var.end())
use_pointer(checks, *it);
use_dead_pointer(checks, *it);
}
}

View File

@ -2022,6 +2022,13 @@ private:
"}\n");
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..
checkUninitVar("void foo()\n"
"{\n"