Added new test for invalid deallocation

This commit is contained in:
Gianluca Scacco 2009-08-09 15:43:00 +02:00
parent ab12b9923d
commit ba4754a784
1 changed files with 11 additions and 0 deletions

View File

@ -65,6 +65,7 @@ private:
TEST_CASE(testautovar_array);
TEST_CASE(testautovar_return);
TEST_CASE(testautovar_extern);
TEST_CASE(testinvaliddealloc);
TEST_CASE(returnLocalVariable1);
TEST_CASE(returnLocalVariable2);
@ -116,6 +117,16 @@ private:
ASSERT_EQUALS("", errout.str());
}
void testinvaliddealloc()
{
check("int* func1()\n"
"{\n"
"int a;\n"
"char tmp[256];\n"
"free (tmp);\n"
"return 0;");
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Invalid deallocation\n"), errout.str());
}
void returnLocalVariable1()
{