summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/leak.cc
blob: df7850fa3cf24c8cbbc44ff0d3a94ea79244cb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Minimal test for LeakSanitizer+AddressSanitizer.
// REQUIRES: asan-64-bits
//
// RUN: %clangxx_asan  %s -o %t
// RUN: ASAN_OPTIONS=detect_leaks=1 not %run %t  2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS=""             not %run %t  2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS=detect_leaks=0     %run %t
#include <stdio.h>
int *t;

int main(int argc, char **argv) {
  t = new int[argc - 1];
  printf("t: %p\n", t);
  t = 0;
}
// CHECK: LeakSanitizer: detected memory leaks