Added test case TestMemleak::dealloc_and_alloc_in_func

This commit is contained in:
Reijo Tomperi 2009-05-27 22:16:54 +03:00
parent ca6d927dfa
commit d6a34dafb2
2 changed files with 21 additions and 1 deletions

View File

@ -224,6 +224,7 @@ private:
TEST_CASE(dir_functions);
TEST_CASE(pointer_to_pointer);
TEST_CASE(dealloc_and_alloc_in_func);
}
@ -2290,6 +2291,25 @@ private:
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
}
void dealloc_and_alloc_in_func()
{
check("char *f( const char *x )\n"
"{\n"
" delete [] x;\n"
" return new char[10];\n"
"}\n"
"\n"
"int main()\n"
"{\n"
" char *a=0;\n"
" a = f( a );\n"
" a[0] = 1;\n"
" delete [] a;\n"
" return 0;\n"
"}\n");
TODO_ASSERT_EQUALS(std::string(""), errout.str());
}
};
REGISTER_TEST(TestMemleak)