diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 8e219d5f6..ebd1ce327 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -394,7 +394,8 @@ private: ASSERT_EQUALS("", errout.str()); } - void return4() { + void return4() { // ticket #3862 + // avoid false positives check("void f(char *p, int x) {\n" " if (x==12) {n" " free(p);\n" @@ -403,6 +404,24 @@ private: " free(p);\n" "}"); ASSERT_EQUALS("", errout.str()); + + check("void f(char *p, int x) {\n" + " if (x==12) {n" + " delete p;\n" + " throw 1;\n" + " }\n" + " delete p;\n" + "}"); + ASSERT_EQUALS("", errout.str()); + + check("void f(char *p, int x) {\n" + " if (x==12) {n" + " delete [] p;\n" + " throw 1;\n" + " }\n" + " delete [] p;\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void test1() { // 3809