backtrace->contains_function takes multiple names, speeding up whitelist check drastically
This commit is contained in:
@@ -232,22 +232,6 @@ char *whitelist[] = {
|
||||
"gpg_err_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
|
||||
*/
|
||||
@@ -260,7 +244,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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user