159e422c9SFangrui Song // RUN: %clang_lsan %s -o %t 259e422c9SFangrui Song // RUN: %env_lsan_opts=use_stacks=0 not %run %t 2>&1 | FileCheck %s 359e422c9SFangrui Song 4*466fab5cSDavid Spickett /// Fails when only leak sanitizer is enabled 5*466fab5cSDavid Spickett // UNSUPPORTED: arm-linux, armhf-linux 6*466fab5cSDavid Spickett 759e422c9SFangrui Song #include <stdio.h> 859e422c9SFangrui Song #include <stdlib.h> 959e422c9SFangrui Song 1059e422c9SFangrui Song // CHECK: {{Leak|Address}}Sanitizer: detected memory leaks 1159e422c9SFangrui Song // CHECK: {{Leak|Address}}Sanitizer: 1 byte(s) leaked in 1 allocation(s). 1259e422c9SFangrui Song main()1359e422c9SFangrui Songint main() { 1459e422c9SFangrui Song // The behavior of malloc(0) is implementation-defined. 1559e422c9SFangrui Song char *p = malloc(0); 1659e422c9SFangrui Song fprintf(stderr, "zero: %p\n", p); 1759e422c9SFangrui Song p = 0; 1859e422c9SFangrui Song } 19