diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 1fb3170fe..8e219d5f6 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -63,6 +63,7 @@ private: TEST_CASE(ifelse3); TEST_CASE(ifelse4); TEST_CASE(ifelse5); + TEST_CASE(ifelse6); // #3370 // switch TEST_CASE(switch1); @@ -327,6 +328,17 @@ private: ASSERT_EQUALS("", errout.str()); } + void ifelse6() { // #3370 + check("void f(int x) {\n" + " int *a = malloc(20);\n" + " if (x)\n" + " free(a);\n" + " else\n" + " a = 0;\n" + "}\n"); + ASSERT_EQUALS("[test.c:7]: (information) free configuration is needed to establish if there is a leak or not\n", errout.str()); + } + void switch1() { check("void f() {\n" " char *p = 0;\n"