Memory leak: find memory leak in TestMemleak::unknownFunction2

This commit is contained in:
Daniel Marjamäki 2009-02-08 18:27:09 +00:00
parent 0361c9d338
commit 81ed48562c
2 changed files with 9 additions and 2 deletions

View File

@ -851,6 +851,13 @@ void CheckMemoryLeakClass::simplifycode(Token *tok)
done = false; done = false;
} }
// Remove "if { dealloc ; callfunc ; } !!else"
else if (Token::Match(tok2->next(), "if { dealloc|assign|use ; callfunc ; } !!else"))
{
erase(tok2, tok2->tokAt(8));
done = false;
}
// Reducing if.. // Reducing if..
else if (_settings._showAll) else if (_settings._showAll)
{ {

View File

@ -189,7 +189,7 @@ private:
// Calls to unknown functions.. they may throw exception, quit the program, etc // Calls to unknown functions.. they may throw exception, quit the program, etc
TEST_CASE(unknownFunction1); TEST_CASE(unknownFunction1);
// TODO TEST_CASE(unknownFunction2); TEST_CASE(unknownFunction2);
} }
@ -1853,7 +1853,7 @@ private:
" ThrowException();\n" " ThrowException();\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:9] (error) Memory leak: p\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: p\n", errout.str());
} }
}; };