]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/asan/TestCases/Posix/free_hook_realloc.cc
1 // Check that free hook doesn't conflict with Realloc.
2 // RUN: %clangxx_asan -O2 %s -o %t
3 // RUN: %run %t 2>&1 | FileCheck %s
7 #include <sanitizer/allocator_interface.h>
12 void __sanitizer_free_hook(const volatile void *ptr
) {
13 if (ptr
== glob_ptr
) {
15 write(1, "FreeHook\n", sizeof("FreeHook\n"));
21 int *x
= (int*)malloc(100);
24 int *y
= (int*)realloc(x
, 200);
25 // Verify that free hook was called and didn't spoil the memory.
29 write(1, "Passed\n", sizeof("Passed\n"));