1 // Test for incorrect use of __lsan_ignore_object(). 2 // RUN: LSAN_BASE="verbosity=2" 3 // RUN: %clangxx_lsan %s -o %t 4 // RUN: LSAN_OPTIONS=$LSAN_BASE ASAN_OPTIONS=$ASAN_OPTIONS:verbosity=2 %run %t 2>&1 | FileCheck %s 5 6 #include <stdio.h> 7 #include <stdlib.h> 8 9 #include "sanitizer/lsan_interface.h" 10 11 int main() { 12 void *p = malloc(1337); 13 fprintf(stderr, "Test alloc: %p.\n", p); 14 __lsan_ignore_object(p); 15 __lsan_ignore_object(p); 16 free(p); 17 __lsan_ignore_object(p); 18 return 0; 19 } 20 // CHECK: Test alloc: [[ADDR:.*]]. 21 // CHECK: heap object at [[ADDR]] is already being ignored 22 // CHECK: no heap object found at [[ADDR]] 23