1 // Test for __lsan_disable() / __lsan_enable(). 2 // RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0" 3 // RUN: %clang_lsan %s -o %t 4 // RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s 5 6 #include <stdio.h> 7 #include <stdlib.h> 8 9 #include "sanitizer/lsan_interface.h" 10 main()11int main() { 12 void **p; 13 { 14 __lsan_disable(); 15 p = malloc(sizeof(void *)); 16 __lsan_enable(); 17 } 18 *p = malloc(666); 19 void *q = malloc(1337); 20 // Break optimization. 21 fprintf(stderr, "Test alloc: %p.\n", q); 22 return 0; 23 } 24 // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s) 25