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