diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 94b43db5b..b86a98ef8 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -52,7 +52,7 @@ static const char * const call_func_white_list[] = , "setbuf", "setbuffer", "setlinebuf", "setvbuf", "snprintf", "sprintf", "strcasecmp" , "strcat", "strchr", "strcmp", "strcpy", "stricmp", "strncat", "strncmp" , "strncpy", "strrchr", "strstr", "strtod", "strtol", "strtoul", "switch" - , "sync_file_range", "telldir", "while", "write", "writev" + , "sync_file_range", "telldir", "typeid", "while", "write", "writev" }; static int call_func_white_list_compare(const void *a, const void *b) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index e22591f3f..540f4fb75 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -269,6 +269,7 @@ private: // Unknown syntax TEST_CASE(unknownSyntax1); + TEST_CASE(knownFunctions); } @@ -2324,6 +2325,16 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); } + + void knownFunctions() + { + check("void foo()\n" + "{\n" + " int *p = new int[100];\n" + " typeid(p);\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: p\n", errout.str()); + } }; static TestMemleakInFunction testMemleakInFunction;