From 84f190abf770beb790f20cdc352c082e3df874d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 9 Sep 2011 07:25:47 +0200 Subject: [PATCH] Fixed #3096 (false negative: memory leak not found when passing string to strtok) --- lib/checkmemoryleak.cpp | 2 +- test/testmemleak.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 19d325592..b0771b14a 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -71,7 +71,7 @@ static const char * const call_func_white_list[] = , "setbuf", "setbuffer", "sethostname", "setlinebuf", "setlocale" ,"setvbuf", "sizeof" ,"snprintf", "sprintf", "sscanf" , "stat", "stpcpy", "strcasecmp", "strcat", "strchr", "strcmp", "strcoll" , "strcpy", "strcspn", "strdup", "stricmp", "strlen", "strncasecmp", "strncat", "strncmp" - , "strncpy", "strpbrk","strrchr", "strspn", "strstr", "strtod", "strtol", "strtoul", "strxfrm", "switch" + , "strncpy", "strpbrk","strrchr", "strspn", "strstr", "strtod", "strtok", "strtol", "strtoul", "strxfrm", "switch" , "symlink", "sync_file_range", "system", "telldir", "tempnam", "time", "typeid", "unlink" , "utime", "utimes", "vasprintf", "vfprintf", "vfscanf", "vprintf" , "vscanf", "vsnprintf", "vsprintf", "vsscanf", "while", "wordexp","write", "writev" diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index d62d4f849..c9cb1fede 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -599,11 +599,14 @@ private: , "getservbyname", "getservbyport", "glob", "index", "inet_addr", "inet_aton", "inet_network" , "initgroups", "link", "mblen", "mbstowcs", "mbtowc", "mkdir", "mkfifo", "mknod", "obstack_printf" , "obstack_vprintf", "opendir", "parse_printf_format", "pathconf", "popen", "psignal", "putenv" - , "readlink", "regcomp", "strxfrm", "wordexp", "sizeof" + , "readlink", "regcomp", "strxfrm", "wordexp", "sizeof", "strtok" }; for (unsigned int i = 0; i < (sizeof(call_func_white_list) / sizeof(char *)); ++i) - ASSERT_EQUALS(true, CheckMemoryLeakInFunction::test_white_list(call_func_white_list[i])); + { + bool ret = CheckMemoryLeakInFunction::test_white_list(call_func_white_list[i]); + ASSERT_EQUALS("", ret ? "" : call_func_white_list[i]); + } }