File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -348,7 +348,6 @@ class TestMemleakInFunction : public TestFixture {
348348
349349 TEST_CASE (trac1949);
350350 TEST_CASE (trac2540);
351- TEST_CASE (trac3888); // #3888 False negative: memory leak through member function
352351
353352 // #2662: segfault because of endless recursion (call_func -> getAllocationType -> functionReturnType -> call_func ..)
354353 TEST_CASE (trac2662);
@@ -2605,6 +2604,19 @@ class TestMemleakInFunction : public TestFixture {
26052604 " char *x = c.a();\n "
26062605 " }" );
26072606 ASSERT_EQUALS (" [test.cpp:6]: (error) Memory leak: x\n " , errout.str ());
2607+
2608+ check (" class Pool{\n "
2609+ " int* GetNewObj()\n "
2610+ " {\n "
2611+ " return new int;\n "
2612+ " }\n "
2613+ " };\n "
2614+ " void foo(){\n "
2615+ " Pool pool;\n "
2616+ " int* a = pool.GetNewObj();\n "
2617+ " int* b = GetNewObj();\n "
2618+ " }" );
2619+ ASSERT_EQUALS (" [test.cpp:11]: (error) Memory leak: a\n " , errout.str ());
26082620 }
26092621
26102622 void throw1 () {
@@ -3804,21 +3816,6 @@ class TestMemleakInFunction : public TestFixture {
38043816 ASSERT_EQUALS (" [test.cpp:5]: (error) Memory leak: str\n " , errout.str ());
38053817 }
38063818
3807- void trac3888 () {
3808- check (" class Pool{\n "
3809- " int* GetNewObj()\n "
3810- " {\n "
3811- " return new int;\n "
3812- " }\n "
3813- " };\n "
3814- " void foo(){\n "
3815- " Pool pool;\n "
3816- " int* a = pool.GetNewObj();\n "
3817- " int* b = GetNewObj();\n "
3818- " }" );
3819- ASSERT_EQUALS (" [test.cpp:11]: (error) Memory leak: a\n " , errout.str ());
3820- }
3821-
38223819 void trac2662 () {
38233820 // segfault because of endless recursion
38243821 // call_func -> getAllocationType -> functionReturnType -> call_func ..
You can’t perform that action at this time.
0 commit comments