summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/leak_detective.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/leak_detective.c')
-rw-r--r--src/libstrongswan/utils/leak_detective.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c
index 5673fc32d..52e92951b 100644
--- a/src/libstrongswan/utils/leak_detective.c
+++ b/src/libstrongswan/utils/leak_detective.c
@@ -218,25 +218,23 @@ char *whitelist[] = {
"gcry_create_nonce",
/* NSPR */
"PR_CallOnce",
+ /* libapr */
+ "apr_pool_create_ex",
+ /* glib */
+ "g_type_init_with_debug_flags",
+ "g_type_register_static",
+ "g_type_class_ref",
+ "g_type_create_instance",
+ "g_type_add_interface_static",
+ "g_type_interface_add_prerequisite",
+ "g_socket_connection_factory_lookup_type",
+ /* libgpg */
+ "gpg_err_init",
+ /* gnutls */
+ "gnutls_global_init",
};
/**
- * check if a stack frame contains functions listed above
- */
-static bool is_whitelisted(backtrace_t *backtrace)
-{
- int i;
- for (i = 0; i < sizeof(whitelist)/sizeof(char*); i++)
- {
- if (backtrace->contains_function(backtrace, whitelist[i]))
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
* Report leaks at library destruction
*/
static void report(private_leak_detective_t *this, bool detailed)
@@ -248,7 +246,8 @@ static void report(private_leak_detective_t *this, bool detailed)
for (hdr = first_header.next; hdr != NULL; hdr = hdr->next)
{
- if (is_whitelisted(hdr->backtrace))
+ if (hdr->backtrace->contains_function(hdr->backtrace,
+ whitelist, countof(whitelist)))
{
whitelisted++;
}