Fixed #1156 ([False positive] Uninitialized variable - class member in constructor)
This commit is contained in:
parent
6fd74dce47
commit
9aca2e7680
|
@ -1375,6 +1375,8 @@ private:
|
||||||
static void dealloc_pointer(bool &foundError, std::list<ExecutionPath *> &checks, const Token *tok)
|
static void dealloc_pointer(bool &foundError, std::list<ExecutionPath *> &checks, const Token *tok)
|
||||||
{
|
{
|
||||||
const unsigned int varid(tok->varId());
|
const unsigned int varid(tok->varId());
|
||||||
|
if (!varid)
|
||||||
|
return;
|
||||||
|
|
||||||
std::list<ExecutionPath *>::const_iterator it;
|
std::list<ExecutionPath *>::const_iterator it;
|
||||||
for (it = checks.begin(); it != checks.end(); ++it)
|
for (it = checks.begin(); it != checks.end(); ++it)
|
||||||
|
|
|
@ -1094,6 +1094,17 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("class Fred {\n"
|
||||||
|
"public:\n"
|
||||||
|
" FILE *f;\n"
|
||||||
|
" ~Fred();\n"
|
||||||
|
"}\n"
|
||||||
|
"Fred::~Fred()\n"
|
||||||
|
"{\n"
|
||||||
|
" fclose(f);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// goto..
|
// goto..
|
||||||
checkUninitVar("void foo(int x)\n"
|
checkUninitVar("void foo(int x)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue