We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a74a1e7 commit 84885d5Copy full SHA for 84885d5
1 file changed
test/testmemleak.cpp
@@ -1674,6 +1674,7 @@ class TestMemleakStructMember : public TestFixture {
1674
TEST_CASE(assign3);
1675
TEST_CASE(assign4); // #11019
1676
TEST_CASE(assign5);
1677
+ TEST_CASE(assign6);
1678
1679
// Failed allocation
1680
TEST_CASE(failedAllocation);
@@ -1955,6 +1956,15 @@ class TestMemleakStructMember : public TestFixture {
1955
1956
ASSERT_EQUALS("", errout_str());
1957
}
1958
1959
+ void assign6() {
1960
+ check("struct S { S* p; };\n" // #14524
1961
+ "void f() {\n"
1962
+ " S s;\n"
1963
+ " s.p = static_cast<S*>(malloc(sizeof(S)));\n"
1964
+ "}\n");
1965
+ ASSERT_EQUALS("[test.cpp:5:1]: (error) Memory leak: s.p [memleak]\n", errout_str());
1966
+ }
1967
+
1968
void failedAllocation() {
1969
check("static struct ABC * foo()\n"
1970
"{\n"
0 commit comments