[asan] enable LeakSanitizer (LSan) by default in asan. This only affects Linux x86_64...
[blocksruntime.git] / test / asan / TestCases / Linux / leak.cc
blob42ee84b9c3815221f6dcdc8accde3dd5cce9505e
1 // Minimal test for LeakSanitizer+AddressSanitizer.
2 // REQUIRES: asan-64-bits
3 //
4 // RUN: %clangxx_asan %s -o %t
5 // RUN: ASAN_OPTIONS=detect_leaks=1 not %t 2>&1 | FileCheck %s
6 // RUN: not %t 2>&1 | FileCheck %s
7 // RUN: ASAN_OPTIONS=detect_leaks=0 %t
8 #include <stdio.h>
9 int *t;
11 int main(int argc, char **argv) {
12 t = new int[argc - 1];
13 printf("t: %p\n", t);
14 t = 0;
16 // CHECK: LeakSanitizer: detected memory leaks