Memory leaks: Added allocation function 'g_strdup_printf'

This commit is contained in:
Daniel Marjamäki 2010-06-06 11:09:19 +02:00
parent 68ad8219ed
commit a9196e8710
2 changed files with 2 additions and 0 deletions

View File

@ -130,6 +130,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
"g_try_malloc0", "g_try_malloc0",
"g_strdup", "g_strdup",
"g_strndup", "g_strndup",
"g_strdup_printf",
0 0
}; };
for (unsigned int i = 0; gmallocfunc[i]; i++) for (unsigned int i = 0; gmallocfunc[i]; i++)

View File

@ -427,6 +427,7 @@ private:
ASSERT_EQUALS(";;alloc;", getcode("int *a = new int[10];", "a")); 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("int * const a = new int[10];", "a"));
ASSERT_EQUALS(";;alloc;", getcode("const 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; // alloc; return use;
ASSERT_EQUALS(";;alloc;returnuse;", getcode("int *a = new int[10]; return a;", "a")); ASSERT_EQUALS(";;alloc;returnuse;", getcode("int *a = new int[10]; return a;", "a"));