1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3// UNSUPPORTED: asan-64-bits
4#include <cassert>
5#include <windows.h>
6
7int main() {
8 void *allocation = HeapAlloc(GetProcessHeap(), 0, 10);
9 assert(allocation != 0);
10 assert(HeapFree(GetProcessHeap(), 0, allocation));
11 HeapFree(GetProcessHeap(), 0, allocation); //will dump
12 assert(0 && "HeapFree double free should produce an ASAN dump\n");
13 return 0;
14}
15
16// CHECK: AddressSanitizer: attempting double-free on [[addr:0x[0-9a-fA-F]+]] in thread T0:
17

source code of compiler-rt/test/asan/TestCases/Windows/heapalloc_doublefree.cpp