[PATCH] D31983: Free zone name when destroying malloc zone

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 10:47:38 PDT 2017


fjricci created this revision.

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.


https://reviews.llvm.org/D31983

Files:
  lib/sanitizer_common/sanitizer_malloc_mac.inc


Index: lib/sanitizer_common/sanitizer_malloc_mac.inc
===================================================================
--- lib/sanitizer_common/sanitizer_malloc_mac.inc
+++ lib/sanitizer_common/sanitizer_malloc_mac.inc
@@ -59,6 +59,9 @@
     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);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31983.94998.patch
Type: text/x-patch
Size: 493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/0ba27b07/attachment.bin>


More information about the llvm-commits mailing list