cleanup testcases: moved testcases from #3888 into allocfunc13 which contains similar testcases already.

This commit is contained in:
Ettl Martin 2013-04-03 10:12:36 +02:00
parent 08ac48199e
commit 3e8eddc69e
1 changed files with 13 additions and 16 deletions

View File

@ -348,7 +348,6 @@ private:
TEST_CASE(trac1949);
TEST_CASE(trac2540);
TEST_CASE(trac3888); // #3888 False negative: memory leak through member function
// #2662: segfault because of endless recursion (call_func -> getAllocationType -> functionReturnType -> call_func ..)
TEST_CASE(trac2662);
@ -2605,6 +2604,19 @@ private:
" char *x = c.a();\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: x\n", errout.str());
check("class Pool{\n"
" int* GetNewObj()\n"
" {\n"
" return new int;\n"
" }\n"
"};\n"
"void foo(){\n"
" Pool pool;\n"
" int* a = pool.GetNewObj();\n"
" int* b = GetNewObj();\n"
"}");
ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: a\n", errout.str());
}
void throw1() {
@ -3804,21 +3816,6 @@ private:
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: str\n", errout.str());
}
void trac3888() {
check("class Pool{\n"
" int* GetNewObj()\n"
" {\n"
" return new int;\n"
" }\n"
"};\n"
"void foo(){\n"
" Pool pool;\n"
" int* a = pool.GetNewObj();\n"
" int* b = GetNewObj();\n"
"}");
ASSERT_EQUALS("[test.cpp:11]: (error) Memory leak: a\n", errout.str());
}
void trac2662() {
// segfault because of endless recursion
// call_func -> getAllocationType -> functionReturnType -> call_func ..