1// RUN: LSAN_BASE="use_registers=0:use_stacks=0" 2// RUN: %clangxx_lsan %s -o %t 3 4// RUN: echo "leak:*LSanTestLeakingFunc*" > %t.supp1 5// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions=%t.supp1 not %run %t 2>&1 | FileCheck %s 6 7// RUN: echo "leak:%t" > %t.supp2 8// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions="%t.supp2":symbolize=false %run %t 9 10#include <stdio.h> 11#include <stdlib.h> 12 13void LSanTestLeakingFunc() { 14 void *p = malloc(666); 15 fprintf(stderr, "Test alloc: %p.\n", p); 16} 17 18int main() { 19 LSanTestLeakingFunc(); 20 void *q = malloc(1337); 21 fprintf(stderr, "Test alloc: %p.\n", q); 22 return 0; 23} 24// CHECK: Suppressions used: 25// CHECK: 1 666 *LSanTestLeakingFunc* 26// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s) 27