From a9196e8710edfffcbe12d8ca3d18606dd0cfa742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 6 Jun 2010 11:09:19 +0200 Subject: [PATCH] Memory leaks: Added allocation function 'g_strdup_printf' --- lib/checkmemoryleak.cpp | 1 + test/testmemleak.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index e5e51d627..7d82c576e 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -130,6 +130,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, "g_try_malloc0", "g_strdup", "g_strndup", + "g_strdup_printf", 0 }; for (unsigned int i = 0; gmallocfunc[i]; i++) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 345197c18..d5c25f4aa 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -427,6 +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")); // alloc; return use; ASSERT_EQUALS(";;alloc;returnuse;", getcode("int *a = new int[10]; return a;", "a"));