From e140ff6e8404ebbd7950fadb6c55a55ff9bbbc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 6 Jun 2010 11:22:59 +0200 Subject: [PATCH] Memory leaks: skipping function call inside allocation --- lib/checkmemoryleak.cpp | 6 ++++++ test/testmemleak.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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"));