summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-18 11:32:24 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-18 11:32:24 +0000
commit37f2aec2a0442293947967f49aa071034b728521 (patch)
tree0586fbc74970272b2cf5aae1c0e429a254591139 /test/asan/TestCases/large_allocator_unpoisons_on_free.cc
parent3496bac65f821b52978853130a458525a9b303c4 (diff)
[asan] Fix one test on OSX.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/large_allocator_unpoisons_on_free.cc')
-rw-r--r--test/asan/TestCases/large_allocator_unpoisons_on_free.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/asan/TestCases/large_allocator_unpoisons_on_free.cc b/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
index f95cc4431..4d7b7e950 100644
--- a/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
+++ b/test/asan/TestCases/large_allocator_unpoisons_on_free.cc
@@ -5,13 +5,26 @@
// RUN: ASAN_OPTIONS=quarantine_size=1 %t
#include <assert.h>
-#include <malloc.h>
#include <string.h>
#include <sys/mman.h>
+#include <stdlib.h>
+
+#ifdef __ANDROID__
+#include <malloc.h>
+void *my_memalign(size_t boundary, size_t size) {
+ return memalign(boundary, size);
+}
+#else
+void *my_memalign(size_t boundary, size_t size) {
+ void *p;
+ posix_memalign(&p, boundary, size);
+ return p;
+}
+#endif
int main() {
const int kPageSize = 4096;
- void *p = memalign(kPageSize, 1024 * 1024);
+ void *p = my_memalign(kPageSize, 1024 * 1024);
free(p);
char *q = (char *)mmap(p, kPageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0);