[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:05:24 PDT 2017
fjricci updated this revision to Diff 94993.
fjricci added a comment.
Remove hack to clear malloc zone name
https://reviews.llvm.org/D31978
Files:
lib/asan/tests/asan_mac_test_helpers.mm
test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
test/asan/TestCases/Darwin/scribble.cc
test/asan/TestCases/Darwin/suppressions-darwin.cc
test/asan/TestCases/Darwin/suppressions-sandbox.cc
Index: test/asan/TestCases/Darwin/suppressions-sandbox.cc
===================================================================
--- test/asan/TestCases/Darwin/suppressions-sandbox.cc
+++ 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
Index: test/asan/TestCases/Darwin/suppressions-darwin.cc
===================================================================
--- test/asan/TestCases/Darwin/suppressions-darwin.cc
+++ 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: test/asan/TestCases/Darwin/scribble.cc
===================================================================
--- test/asan/TestCases/Darwin/scribble.cc
+++ 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: test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
===================================================================
--- test/asan/TestCases/Darwin/malloc_set_zone_name-mprotect.cc
+++ 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: lib/asan/tests/asan_mac_test_helpers.mm
===================================================================
--- lib/asan/tests/asan_mac_test_helpers.mm
+++ lib/asan/tests/asan_mac_test_helpers.mm
@@ -237,4 +237,5 @@
[[NSURL alloc] initWithString:@"Saved Application State"
relativeToURL:base];
[u release];
+ [base release];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31978.94993.patch
Type: text/x-patch
Size: 2008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/625f9ae8/attachment.bin>
More information about the llvm-commits
mailing list