Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // Minimal test for LeakSanitizer+AddressSanitizer. |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 2 | // REQUIRES: leak-detection |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 3 | // |
| 4 | // RUN: %clangxx_asan %s -o %t |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 5 | // 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 Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 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 |