tzset() is hard to whitelist on some systems, as there is no symbol involved.
Call tzset() explicitly before initialization to avoid false positives.
#include <netdb.h>
#include <locale.h>
#include <dlfcn.h>
+#include <time.h>
#include "leak_detective.h"
"pthread_setspecific",
"__pthread_setspecific",
/* glibc functions */
- "mktime",
- "ctime",
- "__gmtime_r",
- "localtime_r",
- "tzset",
- "time_printf_hook",
"inet_ntoa",
"strerror",
"getprotobyname",
"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
lock = spinlock_create();
thread_disabled = thread_value_create(NULL);
+ init_static_allocations();
+
if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
{
enable_leak_detective();