diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 7d82c576e..d45294452 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -941,6 +941,12 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::listtokAt(3)->link(); + continue; + } } // assignment.. diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index d5c25f4aa..2343f8bc0 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -427,7 +427,7 @@ private: ASSERT_EQUALS(";;alloc;", getcode("int *a = new int[10];", "a")); ASSERT_EQUALS(";;alloc;", getcode("int * const a = new int[10];", "a")); ASSERT_EQUALS(";;alloc;", getcode("const int * const a = new int[10];", "a")); - ASSERT_EQUALS(";;alloc;", getcode("char *a = g_strdup_printf(\"ab\");", "a")); + ASSERT_EQUALS(";;alloc;", getcode("char *a = g_strdup_printf(\"%i\", f());", "a")); // alloc; return use; ASSERT_EQUALS(";;alloc;returnuse;", getcode("int *a = new int[10]; return a;", "a"));