Merge pull request #229 from scriptum/#3236

Added regression for #3236
This commit is contained in:
Daniel Marjamäki 2014-02-02 09:52:14 -08:00
commit 0166a717c5
1 changed files with 10 additions and 0 deletions

View File

@ -231,6 +231,7 @@ private:
TEST_CASE(func25); // Ticket #2904 TEST_CASE(func25); // Ticket #2904
TEST_CASE(func26); TEST_CASE(func26);
TEST_CASE(func27); // Ticket #2773 TEST_CASE(func27); // Ticket #2773
TEST_CASE(func28); // Ticket #3236
TEST_CASE(allocfunc1); TEST_CASE(allocfunc1);
TEST_CASE(allocfunc2); TEST_CASE(allocfunc2);
@ -2307,6 +2308,15 @@ private:
ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: pData\n", errout.str()); 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() { void allocfunc1() {
check("static char *a()\n" check("static char *a()\n"
"{\n" "{\n"