summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/leak_detective.c
diff options
context:
space:
mode:
authorRené Mayrhofer <rene@mayrhofer.eu.org>2011-03-05 09:20:09 +0100
committerRené Mayrhofer <rene@mayrhofer.eu.org>2011-03-05 09:20:09 +0100
commit568905f488e63e28778f87ac0e38d845f45bae79 (patch)
treed9969a147e36413583ff4bc75542d34c955f8823 /src/libstrongswan/utils/leak_detective.c
parentf73fba54dc8b30c6482e1e8abf15bbf455592fcd (diff)
downloadvyos-strongswan-568905f488e63e28778f87ac0e38d845f45bae79.tar.gz
vyos-strongswan-568905f488e63e28778f87ac0e38d845f45bae79.zip
Imported Upstream version 4.5.1
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++;
}