Test case added: strcat_result_assignment

This commit is contained in:
Reijo Tomperi 2009-01-25 15:56:19 +00:00
parent 9c51729be6
commit 7631b0b339
1 changed files with 16 additions and 0 deletions

View File

@ -173,6 +173,7 @@ private:
// free a free'd pointer
TEST_CASE(freefree1);
TEST_CASE(freefree2);
// TODO TEST_CASE(strcat_result_assignment);
}
@ -1668,6 +1669,21 @@ private:
ASSERT_EQUALS(std::string(""), errout.str());
}
void strcat_result_assignment()
{
check("#include <stdlib.h>\n"
"#include <string.h>\n"
"int main()\n"
"{\n"
"char *p = malloc(10);\n"
"p[0] = 0;\n"
"p = strcat( p, \"a\" );\n"
"free( p );\n"
"return 0;\n"
"}");
ASSERT_EQUALS(std::string(""), errout.str());
}
};
REGISTER_TEST(TestMemleak)