Memory leaks: Make sure leak is found even when using unknown functions
This commit is contained in:
parent
81ed48562c
commit
d8e8e2c7ee
|
@ -190,6 +190,7 @@ private:
|
|||
// Calls to unknown functions.. they may throw exception, quit the program, etc
|
||||
TEST_CASE(unknownFunction1);
|
||||
TEST_CASE(unknownFunction2);
|
||||
TEST_CASE(unknownFunction3);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1856,6 +1857,16 @@ private:
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue