We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f0a646 commit 59796d4Copy full SHA for 59796d4
test/testmemleak.cpp
@@ -1941,6 +1941,18 @@ class TestMemleakStructMember : public TestFixture {
1941
"[test.cpp:10:5]: (error) Resource leak: s.fd [resourceLeak]\n"
1942
"[test.cpp:16:1]: (error) Resource leak: s.fd [resourceLeak]\n",
1943
errout_str());
1944
+
1945
+ check("struct S { int fd; };\n" // #13031
1946
+ "void f() {\n"
1947
+ " struct S* s = malloc(sizeof(struct S));\n"
1948
+ " s->fd = open(\"abc\", O_RDWR | O_NOCTTY);\n"
1949
+ " if (s->fd < 0) {\n"
1950
+ " free(s);\n"
1951
+ " return NULL;\n"
1952
+ " }\n"
1953
+ " return s;\n"
1954
+ "}\n");
1955
+ ASSERT_EQUALS("", errout_str());
1956
}
1957
1958
void failedAllocation() {
0 commit comments