Skip to content

Commit

Permalink
Added regression test for #11246 (danmar#6399)
Browse files Browse the repository at this point in the history
  • Loading branch information
orbitcowboy authored May 12, 2024
1 parent 9d373cf commit a9e479a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/testmemleak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,15 @@ class TestMemleakNoVar : public TestFixture {
"}");
ASSERT_EQUALS("", errout_str());

check("int f( void ) {\n" // FP: #11246
" void* address = malloc( 1 );\n"
" int ok = address != 0;\n"
" if ( ok )\n"
" free( address ), address = 0;\n"
" return 0;\n"
"} ");
ASSERT_EQUALS("", errout_str());

check("char** x(const char* str) {\n"
" char* ptr[] = { malloc(10), malloc(5), strdup(str) };\n"
" return ptr;\n"
Expand Down

0 comments on commit a9e479a

Please sign in to comment.