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:
@@ -333,9 +333,16 @@ HOOK(size_t, size, const void *ptr)
|
|||||||
*/
|
*/
|
||||||
static bool register_hooks()
|
static bool register_hooks()
|
||||||
{
|
{
|
||||||
|
static bool once = FALSE;
|
||||||
malloc_zone_t *zone;
|
malloc_zone_t *zone;
|
||||||
void *page;
|
void *page;
|
||||||
|
|
||||||
|
if (once)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
once = TRUE;
|
||||||
|
|
||||||
zone = malloc_default_zone();
|
zone = malloc_default_zone();
|
||||||
if (zone->version != MALLOC_ZONE_VERSION)
|
if (zone->version != MALLOC_ZONE_VERSION)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user