[PATCH] D31978: Fix memory leaks in address sanitizer darwin tests

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300080: Fix memory leaks in address sanitizer darwin tests (authored by fjricci).

Changed prior to commit:
  https://reviews.llvm.org/D31978?vs=94993&id=94996#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31978

Files:
  compiler-rt/trunk/lib/asan/tests/asan_mac_test_helpers.mm
  compiler-rt/trunk/test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
  compiler-rt/trunk/test/asan/TestCases/Darwin/scribble.cc
  compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
  compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-sandbox.cc


Index: compiler-rt/trunk/lib/asan/tests/asan_mac_test_helpers.mm
===================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_mac_test_helpers.mm
+++ compiler-rt/trunk/lib/asan/tests/asan_mac_test_helpers.mm
@@ -237,4 +237,5 @@
       [[NSURL alloc] initWithString:@"Saved Application State"
                      relativeToURL:base];
   [u release];
+  [base release];
 }
Index: compiler-rt/trunk/test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
@@ -47,5 +47,6 @@
     memset(mem[i], 'a', 8 * (i % kNumIter));
     free(mem[i]);
   }
+  malloc_destroy_zone(zone);
   return 0;
 }
Index: compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
@@ -27,6 +27,7 @@
                               kCFStringEncodingUTF8, FALSE); // BOOM
   fprintf(stderr, "Ignored.\n");
   free(a);
+  CFRelease(str);
 }
 
 // CHECK-CRASH: AddressSanitizer: heap-buffer-overflow
Index: compiler-rt/trunk/test/asan/TestCases/Darwin/scribble.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/scribble.cc
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/scribble.cc
@@ -54,4 +54,5 @@
   fprintf(stderr, "okthxbai!\n");
   // CHECK-SCRIBBLE: okthxbai!
   // CHECK-NOSCRIBBLE: okthxbai!
+  free(my_class_isa);
 }
Index: compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-sandbox.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-sandbox.cc
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-sandbox.cc
@@ -18,6 +18,7 @@
                               kCFStringEncodingUTF8, FALSE);  // BOOM
   fprintf(stderr, "Ignored.\n");
   free(a);
+  CFRelease(str);
 }
 
 // CHECK-CRASH: AddressSanitizer: heap-buffer-overflow


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31978.94996.patch
Type: text/x-patch
Size: 2278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/dca1a9c8/attachment.bin>


More information about the llvm-commits mailing list