197ccf6b8SFangrui Song // RUN: %clangxx_lsan %s -o %t
2*d08e5d4cSClemens Wasser // RUN: %env_lsan_opts=use_registers=0:use_stacks=0 not %run %t 2>&1 | FileCheck %s
397ccf6b8SFangrui Song 
497ccf6b8SFangrui Song #include <stdio.h>
597ccf6b8SFangrui Song #include <stdlib.h>
697ccf6b8SFangrui Song 
797ccf6b8SFangrui Song #include "sanitizer/lsan_interface.h"
897ccf6b8SFangrui Song 
997ccf6b8SFangrui Song extern "C"
__lsan_default_suppressions()1097ccf6b8SFangrui Song const char *__lsan_default_suppressions() {
1197ccf6b8SFangrui Song   return "leak:*LSanTestLeakingFunc*";
1297ccf6b8SFangrui Song }
1397ccf6b8SFangrui Song 
LSanTestLeakingFunc()1497ccf6b8SFangrui Song void LSanTestLeakingFunc() {
1597ccf6b8SFangrui Song   void *p = malloc(666);
1697ccf6b8SFangrui Song   fprintf(stderr, "Test alloc: %p.\n", p);
1797ccf6b8SFangrui Song }
1897ccf6b8SFangrui Song 
main()1997ccf6b8SFangrui Song int main() {
2097ccf6b8SFangrui Song   LSanTestLeakingFunc();
2197ccf6b8SFangrui Song   void *q = malloc(1337);
2297ccf6b8SFangrui Song   fprintf(stderr, "Test alloc: %p.\n", q);
2397ccf6b8SFangrui Song   return 0;
2497ccf6b8SFangrui Song }
2597ccf6b8SFangrui Song // CHECK: Suppressions used:
2697ccf6b8SFangrui Song // CHECK: 1 666 *LSanTestLeakingFunc*
2797ccf6b8SFangrui Song // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
28