testing: Added test for mismatching allocation and deallocation

This commit is contained in:
Daniel Marjamäki 2008-05-10 14:01:12 +00:00
parent ece441d952
commit 3bf21680b2
1 changed files with 12 additions and 0 deletions

View File

@ -681,6 +681,18 @@ static void memleak_in_function()
"}\n";
check( CheckMemoryLeak, __LINE__, test20, "[test.cpp:8]: Memory leak: p\n" );
const char test21[] = "static char *dmalloc()\n"
"{\n"
" char *p = new char[100];\n"
" return p;\n"
"}\n"
"static void f()\n"
"{\n"
" char *p = dmalloc();\n"
" delete p;\n"
"}\n";
check( CheckMemoryLeak, __LINE__, test21, "[test.cpp:8]: Mismatching allocation and deallocation: p\n" );
}
//---------------------------------------------------------------------------