memory leaks: added a todo test case for struct members when using if-else

This commit is contained in:
Daniel Marjamäki 2009-07-23 22:29:31 +02:00
parent 5b81c92a14
commit 73c028bdb7
1 changed files with 23 additions and 0 deletions

View File

@ -2839,6 +2839,9 @@ private:
// Deallocating in a function // Deallocating in a function
TEST_CASE(function); TEST_CASE(function);
// Handle if-else
TEST_CASE(ifelse);
} }
void err() void err()
@ -2974,6 +2977,26 @@ private:
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
void ifelse()
{
check("static void foo()\n"
"{\n"
" struct ABC *abc = malloc(sizeof(struct ABC));\n"
" if (x)"
" {\n"
" abc->a = malloc(10);\n"
" }\n"
" else\n"
" {\n"
" free(abc);\n"
" return;\n"
" }\n"
" free(abc->a);\n"
" free(abc);\n"
"}\n");
TODO_ASSERT_EQUALS("", errout.str());
}
}; };