brintos

brintos / llvm-project-archived public Read only

0
0
Text · 499 B · 5c8d185 Raw
19 lines · c
1// RUN: %clang_lsan %s -o %t2// RUN: %env_lsan_opts=use_stacks=0 not %run %t 2>&1 | FileCheck %s3 4/// Fails when only leak sanitizer is enabled5// UNSUPPORTED: arm-linux, armhf-linux6 7#include <stdio.h>8#include <stdlib.h>9 10// CHECK: {{Leak|Address}}Sanitizer: detected memory leaks11// CHECK: {{Leak|Address}}Sanitizer: 1 byte(s) leaked in 1 allocation(s).12 13int 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