Skip to content

Commit

Permalink
Add test for #12062 (#6102)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Mar 8, 2024
1 parent b564fdd commit f97bab8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3203,6 +3203,14 @@ class TestLeakAutoVarStrcpy : public TestFixture {
" p->f();\n"
"}");
ASSERT_EQUALS("[test.cpp:9]: (error) Memory leak: p\n", errout.str());

check("class B { std::string s; };\n" // #12062
"class D : public B {};\n"
"void g() {\n"
" auto d = new D();\n"
" if (d) {}\n"
"}\n");
ASSERT_EQUALS("[test.cpp:6]: (error) Memory leak: d\n", errout.str());
}
};

Expand Down

0 comments on commit f97bab8

Please sign in to comment.