Memory leak : Added test case "if10" which is similar to "if9"

This commit is contained in:
Daniel Marjamäki 2009-01-02 08:16:32 +00:00
parent 8ff5124233
commit 0e219ec24b
1 changed files with 16 additions and 1 deletions

View File

@ -91,7 +91,8 @@ private:
TEST_CASE( if6 ); // Bug 2432631
TEST_CASE( if7 ); // Bug 2401436
TEST_CASE( if8 ); // Bug 2458532
//TODO TEST_CASE( if9 );
// TODO TEST_CASE( if9 ); // if (realloc)
TEST_CASE( if10 ); // else if (realloc)
TEST_CASE( forwhile1 );
TEST_CASE( forwhile2 );
@ -592,6 +593,20 @@ private:
ASSERT_EQUALS( std::string(""), errout.str() );
}
void if10()
{
check( "static void f()\n"
"{\n"
" char *buf = malloc(10);\n"
" if (aa)\n"
" ;\n"
" else if (buf = realloc(buf, 100))\n"
" ;\n"
" free(buf);\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}