diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 07801b671..caeb3df0e 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -125,6 +125,8 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, } if (! tok2) return No; + if (tok2->str() == "::") + tok2 = tok2->next(); if (! tok2->isName()) return No; diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 51b97d71e..e5f4cd5a1 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -408,6 +408,7 @@ private: void testgetcode() { // alloc; ASSERT_EQUALS(";;alloc;", getcode("int *a = malloc(100);", "a")); + TODO_ASSERT_EQUALS(";;alloc;", ";;alloccallfunc;", getcode("int *a = ::malloc(100);", "a")); ASSERT_EQUALS(";;alloc;", getcode("int *a = new int;", "a")); ASSERT_EQUALS(";;alloc;", getcode("int *a = new int[10];", "a")); ASSERT_EQUALS(";;alloc;", getcode("int **a = new int*[10];", "a"));