From 25607d9f71d1aff57b3080ea638370dd96a93f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 31 Jan 2009 11:51:47 +0000 Subject: [PATCH] mismatching allocation and deallocation: added test case that currently generates false positives --- test/testmemleak.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 285ab210e..0ff7f00fa 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -119,6 +119,7 @@ private: TEST_CASE(ret5); // Bug 2458436 - return use TEST_CASE(mismatch1); + // TODO TEST_CASE(mismatch2); TEST_CASE(func1); TEST_CASE(func2); @@ -952,6 +953,20 @@ private: ASSERT_EQUALS(std::string("[test.cpp:4]: (always) Mismatching allocation and deallocation: a\n"), errout.str()); } + void mismatch2() + { + check("void f()\n" + "{\n" + " FILE *fp;\n" + "\n" + " fp = fopen();\n" + " fclose(fp);\n" + "\n" + " fp = popen();\n" + " pclose(fp);\n" + "}\n"); + ASSERT_EQUALS(std::string(""), errout.str()); + }