We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1aa7249 commit ee311fcCopy full SHA for ee311fc
1 file changed
test/testmemleak.cpp
@@ -2603,6 +2603,17 @@ class TestMemleakNoVar : public TestFixture {
2603
" a.g(new int);\n"
2604
"}\n");
2605
ASSERT_EQUALS("", errout_str());
2606
+
2607
+ check("int f() {\n" // #11184
2608
+ " return strlen(new char[4]{});\n"
2609
+ "}\n"
2610
+ "int g() {\n"
2611
+ " int i = strlen(new char[4]{});\n"
2612
+ " return i;\n"
2613
+ "}\n");
2614
+ ASSERT_EQUALS("[test.cpp:2:19]: (error) Allocation with new, strlen doesn't release it. [leakNoVarFunctionCall]\n"
2615
+ "[test.cpp:5:20]: (error) Allocation with new, strlen doesn't release it. [leakNoVarFunctionCall]\n",
2616
+ errout_str());
2617
}
2618
2619
void missingAssignment() {
0 commit comments