cleanup testcases: moved testcases from #3888 into allocfunc13 which contains similar testcases already.
This commit is contained in:
parent
08ac48199e
commit
3e8eddc69e
|
@ -348,7 +348,6 @@ private:
|
||||||
|
|
||||||
TEST_CASE(trac1949);
|
TEST_CASE(trac1949);
|
||||||
TEST_CASE(trac2540);
|
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 ..)
|
// #2662: segfault because of endless recursion (call_func -> getAllocationType -> functionReturnType -> call_func ..)
|
||||||
TEST_CASE(trac2662);
|
TEST_CASE(trac2662);
|
||||||
|
@ -2605,6 +2604,19 @@ private:
|
||||||
" char *x = c.a();\n"
|
" char *x = c.a();\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: x\n", errout.str());
|
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() {
|
void throw1() {
|
||||||
|
@ -3804,21 +3816,6 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: str\n", errout.str());
|
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() {
|
void trac2662() {
|
||||||
// segfault because of endless recursion
|
// segfault because of endless recursion
|
||||||
// call_func -> getAllocationType -> functionReturnType -> call_func ..
|
// call_func -> getAllocationType -> functionReturnType -> call_func ..
|
||||||
|
|
Loading…
Reference in New Issue