From e06e96e8647232a6c9acac1fa744443bbaff5536 Mon Sep 17 00:00:00 2001 From: Pavel Roschin Date: Sat, 1 Feb 2014 15:51:29 +0400 Subject: [PATCH] Added regression for #3236 (Failure to detect memory leak if pointer members are added) --- test/testmemleak.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index bc709a7d7..9420d7d75 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -231,6 +231,7 @@ private: TEST_CASE(func25); // Ticket #2904 TEST_CASE(func26); TEST_CASE(func27); // Ticket #2773 + TEST_CASE(func28); // Ticket #3236 TEST_CASE(allocfunc1); TEST_CASE(allocfunc2); @@ -2307,6 +2308,15 @@ private: ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: pData\n", errout.str()); } + void func28() { // ticket #3236 + check("void f()\n" + "{\n" + " my_struct *p = malloc(42);\n" + " p->a + p->b;\n" + "}"); + ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: p\n", errout.str()); + } + void allocfunc1() { check("static char *a()\n" "{\n"