1 // Check that free hook doesn't conflict with Realloc.
2 // RUN: %clangxx_memprof -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
4 #include <sanitizer/allocator_interface.h>
10 // (Speculative fix if memprof is enabled on Apple platforms)
11 // Required for dyld macOS 12.0+
16 __sanitizer_free_hook(const volatile void *ptr
) {
17 if (ptr
== glob_ptr
) {
19 write(1, "FreeHook\n", sizeof("FreeHook\n"));
24 int *x
= (int *)malloc(100);
27 int *y
= (int *)realloc(x
, 200);
28 // Verify that free hook was called and didn't spoil the memory.
32 write(1, "Passed\n", sizeof("Passed\n"));