Fixed #2555 (Cppcheck 1.47 - Crash on WinMerge-Trunk (Win7 x64))
This commit is contained in:
parent
aeae5a867d
commit
56ae77ba87
|
@ -1250,7 +1250,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
if ((tok->str() == "else") || (tok->str() == "switch"))
|
if ((tok->str() == "else") || (tok->str() == "switch"))
|
||||||
{
|
{
|
||||||
addtoken(&rettail, tok, tok->str());
|
addtoken(&rettail, tok, tok->str());
|
||||||
if (tok->str() == "switch")
|
if (Token::simpleMatch(tok, "switch ("))
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,7 @@ private:
|
||||||
|
|
||||||
TEST_CASE(switch2);
|
TEST_CASE(switch2);
|
||||||
TEST_CASE(switch3);
|
TEST_CASE(switch3);
|
||||||
|
TEST_CASE(switch4); // #2555 - segfault
|
||||||
|
|
||||||
TEST_CASE(ret5); // Bug 2458436 - return use
|
TEST_CASE(ret5); // Bug 2458436 - return use
|
||||||
TEST_CASE(ret6);
|
TEST_CASE(ret6);
|
||||||
|
@ -1287,6 +1288,17 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: str\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: str\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void switch4()
|
||||||
|
{
|
||||||
|
check("void f() {\n"
|
||||||
|
" switch MAKEWORD(1)\n"
|
||||||
|
" {\n"
|
||||||
|
" case 0:\n"
|
||||||
|
" return;\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void ret5()
|
void ret5()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue