24 lines · cpp
1// RUN: %clang_cl_asan %Od -o %t %s2// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s3// RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s4// RUN: %clang_cl %Od -o %t %s5// RUN: %run %t 2>&1 | FileCheck %s6// UNSUPPORTED: asan-64-bits7#include <cassert>8#include <stdio.h>9#include<windows.h>10 11int main() {12 HANDLE heap = HeapCreate(0, 0, 0);13 void *ptr = HeapAlloc(heap, 0, 4);14 assert(ptr);15 void *ptr2 = HeapReAlloc(heap, 0, ptr, 0);16 assert(ptr2);17 HeapFree(heap, 0, ptr2);18 fprintf(stderr, "passed!\n");19}20 21// CHECK-NOT: double-free22// CHECK-NOT: AddressSanitizer23// CHECK: passed!24