16 lines · cpp
1// Minimal test for LeakSanitizer+AddressSanitizer.2// REQUIRES: leak-detection3//4// RUN: %clangxx_asan %s -o %t5// RUN: %env_asan_opts=detect_leaks=1 not %run %t 2>&1 | FileCheck %s6// RUN: not %run %t 2>&1 | FileCheck %s7// RUN: %env_asan_opts=detect_leaks=0 %run %t8#include <stdio.h>9int *t;10 11int main(int argc, char **argv) {12 t = new int[argc - 1] - 100000;13 printf("t: %p\n", t);14}15// CHECK: LeakSanitizer: detected memory leaks16