summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/leak.cc
blob: 85d55c3cbdbf7726ba9894da6c36ddc1d45b49f5 (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 %t  2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS=""                 %t
// RUN: ASAN_OPTIONS=detect_leaks=0     %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