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