Added regression for #3236 (Failure to detect memory leak if pointer members are added)

This commit is contained in:
Pavel Roschin 2014-02-01 15:51:29 +04:00
parent 9aa9530e0d
commit e06e96e864
1 changed files with 10 additions and 0 deletions

View File

@ -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"