Added testcase for #1557 (false positive: memory leak)

This commit is contained in:
Daniel Marjamäki 2010-06-13 10:43:23 +02:00
parent 5de124280a
commit 37ade20dad
1 changed files with 19 additions and 0 deletions

View File

@ -2850,6 +2850,7 @@ private:
TEST_CASE(class14); TEST_CASE(class14);
TEST_CASE(class15); TEST_CASE(class15);
TEST_CASE(class16); TEST_CASE(class16);
TEST_CASE(class17);
TEST_CASE(staticvar); TEST_CASE(staticvar);
@ -3213,6 +3214,24 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void class17()
{
// Ticket #1557
check("class A {\n"
"private:\n"
" char *pd;\n"
"public:\n"
" void foo();\n"
"};\n"
"\n"
"void A::foo()\n"
"{\n"
" A::pd = new char[12];\n"
" delete [] A::pd;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void staticvar() void staticvar()
{ {
check("class A\n" check("class A\n"