summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/asan/lit_tests/malloc_hook.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/malloc_hook.cc b/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
index 885fc6693fd..6435d105ee2 100644
--- a/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
+++ b/compiler-rt/lib/asan/lit_tests/malloc_hook.cc
@@ -1,13 +1,17 @@
// RUN: %clangxx_asan -O2 %s -o %t
// RUN: %t 2>&1 | FileCheck %s
-#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
extern "C" {
// Note: avoid calling functions that allocate memory in malloc/free
// to avoid infinite recursion.
-void __asan_malloc_hook(void *ptr, size_t sz) { puts("MallocHook"); }
-void __asan_free_hook(void *ptr) { puts("FreeHook"); }
+void __asan_malloc_hook(void *ptr, size_t sz) {
+ write(1, "MallocHook\n", sizeof("MallocHook\n"));
+}
+void __asan_free_hook(void *ptr) {
+ write(1, "FreeHook\n", sizeof("FreeHook\n"));
+}
} // extern "C"
int main() {
OpenPOWER on IntegriCloud