Free zone name when destroying malloc zone
Summary:
The darwin interceptor for malloc_destroy_zone manually frees the
zone struct, but does not free the name component. Make sure to
free the name if it has been set.
Reviewers: kubamracek, alekseyshl
Subscribers: llvm-commits
@@ -59,6 +59,9 @@ INTERCEPTOR(void, malloc_destroy_zone, malloc_zone_t *zone) {
uptr allocated_size = RoundUpTo(sizeof(sanitizer_zone), page_size);
mprotect(zone, allocated_size, PROT_READ | PROT_WRITE);
}
+ if (zone->zone_name) {
+ COMMON_MALLOC_FREE((void *)zone->zone_name);
+ }
COMMON_MALLOC_FREE(zone);
}
