1 // RUN: %clang_lsan %s -o %t
2 // RUN: %env_lsan_opts=use_stacks=0 not %run %t 2>&1 | FileCheck %s
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 // CHECK: {{Leak|Address}}Sanitizer: detected memory leaks
8 // CHECK: {{Leak|Address}}Sanitizer: 1 byte(s) leaked in 1 allocation(s).
9 
10 int main() {
11   // The behavior of malloc(0) is implementation-defined.
12   char *p = malloc(0);
13   fprintf(stderr, "zero: %p\n", p);
14   p = 0;
15 }
16