uninitialized data: minor fix to handle 'new char [' better
This commit is contained in:
parent
45406f5367
commit
d88c236efe
|
@ -1422,7 +1422,9 @@ void CheckOther::uninitvar()
|
|||
continue;
|
||||
|
||||
// goto ')'
|
||||
tok = tok->tokAt(4)->link();
|
||||
tok = tok->tokAt(4);
|
||||
if (tok->str() == "(")
|
||||
tok = tok->link();
|
||||
if (!tok)
|
||||
break;
|
||||
|
||||
|
|
|
@ -1145,6 +1145,12 @@ private:
|
|||
"};\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s\n", errout.str());
|
||||
|
||||
checkUninitVar("void f()\n"
|
||||
"{\n"
|
||||
" char *s1 = new char[10];\n"
|
||||
" char *s2 = new char[strlen(s1)];\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Data is allocated but not initialized: s1\n", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue