From ff1de4c896a6f7769f853b5325dc9509daeaa435 Mon Sep 17 00:00:00 2001 From: Ettl Martin Date: Tue, 22 Mar 2011 22:13:29 +0100 Subject: [PATCH] extended checkmemoryleak-whitelist --- lib/checkmemoryleak.cpp | 37 ++++++++++++++++++++++--------------- test/testmemleak.cpp | 8 +++++++- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index e0b8d032c..7812b10a3 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -47,25 +47,32 @@ CheckMemoryLeakNoVar instance4; // Reference: http://www.aquaphoenix.com/ref/gnu_c_library/libc_492.html#SEC492 static const char * const call_func_white_list[] = { - "_open", "_wopen", "access", "asctime", "asctime_r", "asprintf", "assert" + "_open", "_wopen", "access", "adjtime", "asctime", "asctime_r", "asprintf", "assert" , "atof", "atoi", "atol", "chdir", "chmod", "chown" - , "clearerr", "ctime", "ctime_r", "delete", "fchmod", "fclose", "fcntl" - , "fdatasync", "feof", "ferror", "fflush", "fgetc", "fgetpos", "fgets" - , "flock", "for", "fprintf", "fputc", "fputs", "fread", "free", "freopen", "fscanf", "fseek" - , "fseeko", "fsetpos", "fstat", "fsync", "ftell", "ftello", "ftruncate" - , "fwrite", "getc", "gets", "gmtime", "gmtime_r", "if", "ioctl" - , "localtime", "localtime_r" - , "lockf", "lseek", "lstat", "memchr", "memcmp", "memcpy", "memmove", "memset", "open" - , "perror", "posix_fadvise", "posix_fallocate", "pread" - , "printf", "puts", "pwrite", "qsort", "read", "readahead", "readdir", "readdir_r", "readv" - , "realloc", "remove", "rename", "return", "rewind", "rewinddir", "rindex" ,"rmdir" ,"scandir", "scanf", "seekdir" + , "clearerr", "creat", "ctime", "ctime_r", "delete", "execl", "execle" + , "execlp", "execv", "execve", "fchmod", "fclose", "fcntl" + , "fdatasync", "fdopen", "feof", "ferror", "fflush", "fgetc", "fgetpos", "fgets" + , "flock", "fmemopen", "fnmatch", "fopen", "fopencookie", "for", "fprintf", "fputc", "fputs", "fread", "free" + , "freopen", "fscanf", "fseek", "fseeko", "fsetpos", "fstat", "fsync", "ftell", "ftello" + , "ftruncate", "fwrite", "getc", "getenv","getgrnam", "gethostbyaddr", "gethostbyname", "getnetbyname" + , "getopt", "getopt_long", "getprotobyname", "getpwnam", "gets", "getservbyname", "getservbyport" + , "glob", "gmtime", "gmtime_r", "if", "index", "inet_addr", "inet_aton", "inet_network", "initgroups", "ioctl" + , "link", "localtime", "localtime_r" + , "lockf", "lseek", "lstat", "mblen", "mbstowcs", "mbtowc", "memchr", "memcmp", "memcpy", "memmove", "memset" + , "mkdir", "mkfifo", "mknod" + , "obstack_printf", "obstack_vprintf", "open", "opendir", "parse_printf_format", "pathconf" + , "perror", "popen" ,"posix_fadvise", "posix_fallocate", "pread" + , "printf", "psignal", "putenv", "puts", "pwrite", "qsort", "read", "readahead", "readdir", "readdir_r" + , "readlink", "readv" + , "realloc", "regcomp", "remove", "rename", "return", "rewind", "rewinddir", "rindex" + , "rmdir" ,"scandir", "scanf", "seekdir" , "setbuf", "setbuffer", "sethostname", "setlinebuf", "setlocale" ,"setvbuf", "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", "switch" - , "symlink", "sync_file_range", "system", "telldir", "tempnam","time", "typeid", "unlink" - , "utime", "utimes" ,"vasprintf", "vfprintf", "vfscanf", "vprintf" - , "vscanf", "vsnprintf", "vsprintf", "vsscanf", "while", "write", "writev" + , "strncpy", "strpbrk","strrchr", "strspn", "strstr", "strtod", "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" }; static int call_func_white_list_compare(const void *a, const void *b) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 6fb298921..bf0c0376f 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -581,7 +581,13 @@ private: , "sync_file_range", "telldir", "typeid", "while", "write", "writev", "lstat", "stat" , "_open", "_wopen", "vscanf", "vsscanf", "vfscanf", "vasprintf", "utime", "utimes", "unlink" , "tempnam", "system", "symlink", "strpbrk", "strncasecmp", "strdup", "strcspn", "strcoll" - , "setlocale", "sethostname", "rmdir", "rindex", "rename", "remove" + , "setlocale", "sethostname", "rmdir", "rindex", "rename", "remove", "adjtime", "creat", "execle" + , "execl", "execlp", "execve", "execv", "fdopen", "fmemopen", "fnmatch", "fopencookie", "fopen" + , "getgrnam", "gethostbyaddr", "getnetbyname", "getopt", "getopt_long", "getprotobyname", "getpwnam" + , "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" }; for (unsigned int i = 0; i < (sizeof(call_func_white_list) / sizeof(char *)); ++i)