leak-detective: Register OS X specific hooks just once
If we initialize libstrongswan more than once in the same process, we may not register the hooks twice.
This commit is contained in:
parent
f192526c3f
commit
ef6d78d6ef
|
@ -333,9 +333,16 @@ HOOK(size_t, size, const void *ptr)
|
|||
*/
|
||||
static bool register_hooks()
|
||||
{
|
||||
static bool once = FALSE;
|
||||
malloc_zone_t *zone;
|
||||
void *page;
|
||||
|
||||
if (once)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
once = TRUE;
|
||||
|
||||
zone = malloc_default_zone();
|
||||
if (zone->version != MALLOC_ZONE_VERSION)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue