Memory leaks: Make sure leak is found even when using unknown functions

This commit is contained in:
Daniel Marjamäki 2009-02-08 18:31:09 +00:00
parent 81ed48562c
commit d8e8e2c7ee
1 changed files with 11 additions and 0 deletions

View File

@ -190,6 +190,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);
TEST_CASE(unknownFunction2); TEST_CASE(unknownFunction2);
TEST_CASE(unknownFunction3);
} }
@ -1856,6 +1857,16 @@ private:
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: p\n", errout.str()); ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: p\n", errout.str());
} }
void unknownFunction3()
{
check("void foo()\n"
"{\n"
" int *p = new int[100];\n"
" foo();\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: p\n", errout.str());
}
}; };
REGISTER_TEST(TestMemleak) REGISTER_TEST(TestMemleak)