diff options
author | Martin Willi <martin@revosec.ch> | 2013-04-02 15:47:55 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-05-06 15:15:24 +0200 |
commit | 7e3f6299d5407445393e336f0c53746fafd344d6 (patch) | |
tree | 09272972024e8bc2a6d4496db8fbd9e4c947ecba /src | |
parent | 17211b6b9ae3330c97691dd63ce0d54705de85b3 (diff) | |
download | strongswan-7e3f6299d5407445393e336f0c53746fafd344d6.tar.bz2 strongswan-7e3f6299d5407445393e336f0c53746fafd344d6.tar.xz |
leak-detective: call tzset() explicitly before enabling leak detective
tzset() is hard to whitelist on some systems, as there is no symbol involved.
Call tzset() explicitly before initialization to avoid false positives.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/leak_detective.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c index 69e539d64..2883b88d9 100644 --- a/src/libstrongswan/utils/leak_detective.c +++ b/src/libstrongswan/utils/leak_detective.c @@ -27,6 +27,7 @@ #include <netdb.h> #include <locale.h> #include <dlfcn.h> +#include <time.h> #include "leak_detective.h" @@ -283,12 +284,6 @@ char *whitelist[] = { "pthread_setspecific", "__pthread_setspecific", /* glibc functions */ - "mktime", - "ctime", - "__gmtime_r", - "localtime_r", - "tzset", - "time_printf_hook", "inet_ntoa", "strerror", "getprotobyname", @@ -366,6 +361,14 @@ char *whitelist[] = { "gnutls_global_init", }; +/** + * Some functions are hard to whitelist, as they don't use a symbol directly. + * Use some static initialization to suppress them on leak reports + */ +static void init_static_allocations() +{ + tzset(); +} /** * Hashtable hash function @@ -748,6 +751,8 @@ leak_detective_t *leak_detective_create() lock = spinlock_create(); thread_disabled = thread_value_create(NULL); + init_static_allocations(); + if (getenv("LEAK_DETECTIVE_DISABLE") == NULL) { enable_leak_detective(); |