From 0c910c9775445f60c05336f11b1c8484fc31dbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 11 Nov 2008 20:03:06 +0000 Subject: [PATCH] Memory leak: Added TODO test. Mismatching allocation and deallocation in subfunction --- testmemleak.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/testmemleak.cpp b/testmemleak.cpp index 1b1177670..0c4f3e168 100644 --- a/testmemleak.cpp +++ b/testmemleak.cpp @@ -105,6 +105,7 @@ private: TEST_CASE( func2 ); TEST_CASE( func3 ); TEST_CASE( func4 ); + // TODO TEST_CASE( func5 ); TEST_CASE( class1 ); TEST_CASE( class2 ); @@ -667,6 +668,23 @@ private: } + void func5() + { + // TODO + check( "static void foo(char *str)\n" + "{\n" + " delete str;\n" + "}\n" + "\n" + "static void f()\n" + "{\n" + " char *p = new char[100];\n" + " foo(p);\n" + "}\n" ); + ASSERT_EQUALS( std::string("mismatching allocation and deallocation"), errout.str() ); + } + + /* void func3()