From 0c2f90dcebb9c5e1572f3f49b0f979c224ab4efc Mon Sep 17 00:00:00 2001 From: Nicolas Le Cam Date: Fri, 2 Jan 2009 01:29:07 +0000 Subject: [PATCH] Memory leak : Add a new test that currently fail to highlight a regression --- testmemleak.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/testmemleak.cpp b/testmemleak.cpp index 5c43d08dc..2110f533d 100644 --- a/testmemleak.cpp +++ b/testmemleak.cpp @@ -127,6 +127,7 @@ private: TEST_CASE( func9 ); // Embedding the function call in a if-condition TEST_CASE( func10 ); // Bug 2458510 - Function pointer TEST_CASE( func11 ); // Bug 2458510 - Function pointer + // TODO TEST_CASE( func12 ); TEST_CASE( class1 ); TEST_CASE( class2 ); @@ -1023,6 +1024,22 @@ private: ASSERT_EQUALS( std::string(""), errout.str() ); } + void func12() + { + check( "static void f()\n" + "{\n" + " char *buf = NULL, *tmp;\n" + " if (!(tmp = realloc(buf, 50)))\n" + " {\n" + " free(buf);\n" + " return NULL;\n" + " }\n" + " buf = tmp;\n" + " return buf;\n" + "}\n" ); + ASSERT_EQUALS( std::string(""), errout.str() ); + } + /* void func3()