1// RUN: %clangxx_lsan %s -o %t
2// RUN: %env_lsan_opts=use_registers=0:use_stacks=0 not %run %t 2>&1 | FileCheck %s
3
4#include <stdio.h>
5#include <stdlib.h>
6
7#include "sanitizer/lsan_interface.h"
8
9extern "C"
10const char *__lsan_default_suppressions() {
11 return "leak:*LSanTestLeakingFunc*";
12}
13
14void LSanTestLeakingFunc() {
15 void *p = malloc(size: 666);
16 fprintf(stderr, format: "Test alloc: %p.\n", p);
17}
18
19int main() {
20 LSanTestLeakingFunc();
21 void *q = malloc(size: 1337);
22 fprintf(stderr, format: "Test alloc: %p.\n", q);
23 return 0;
24}
25// CHECK: Suppressions used:
26// CHECK: 1 666 *LSanTestLeakingFunc*
27// CHECK: SUMMARY: {{.*}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
28

source code of compiler-rt/test/lsan/TestCases/suppressions_default.cpp