blob: e22cd6eac16fa591223e0c2d6b0e99cb4c0c7e7b [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001// Minimal test for LeakSanitizer+AddressSanitizer.
Stephen Hines86277eb2015-03-23 12:06:32 -07002// REQUIRES: leak-detection
Stephen Hines2d1fdb22014-05-28 23:58:16 -07003//
4// RUN: %clangxx_asan %s -o %t
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08005// RUN: %env_asan_opts=detect_leaks=1 not %run %t 2>&1 | FileCheck %s
6// RUN: not %run %t 2>&1 | FileCheck %s
7// RUN: %env_asan_opts=detect_leaks=0 %run %t
Stephen Hines2d1fdb22014-05-28 23:58:16 -07008#include <stdio.h>
9int *t;
10
11int 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