]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/asan/TestCases/Linux/leak.cc
Import compiler-rt 3.7.0 release (r246257).
[FreeBSD/FreeBSD.git] / test / asan / TestCases / Linux / leak.cc
1 // Minimal test for LeakSanitizer+AddressSanitizer.
2 // REQUIRES: leak-detection
3 //
4 // RUN: %clangxx_asan  %s -o %t
5 // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_leaks=1 not %run %t  2>&1 | FileCheck %s
6 // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS                not %run %t  2>&1 | FileCheck %s
7 // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:detect_leaks=0     %run %t
8 #include <stdio.h>
9 int *t;
10
11 int main(int argc, char **argv) {
12   t = new int[argc - 1];
13   printf("t: %p\n", t);
14   t = 0;
15 }
16 // CHECK: LeakSanitizer: detected memory leaks