[compiler-rt] r300195 - Free zone name when destroying malloc zone

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 07:00:25 PDT 2017


Author: fjricci
Date: Thu Apr 13 09:00:24 2017
New Revision: 300195

URL: http://llvm.org/viewvc/llvm-project?rev=300195&view=rev
Log:
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

Differential Revision: https://reviews.llvm.org/D31983

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_malloc_mac.inc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_malloc_mac.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_malloc_mac.inc?rev=300195&r1=300194&r2=300195&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_malloc_mac.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_malloc_mac.inc Thu Apr 13 09:00:24 2017
@@ -59,6 +59,9 @@ INTERCEPTOR(void, malloc_destroy_zone, m
     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);
 }
 




More information about the llvm-commits mailing list