| 1 | // Test for incorrect use of __lsan_ignore_object(). |
| 2 | // RUN: %clangxx_lsan %s -o %t |
| 3 | // RUN: %run %t 2>&1 | FileCheck %s |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | |
| 8 | #include "sanitizer/lsan_interface.h" |
| 9 | |
| 10 | int main() { |
| 11 | void *p = malloc(size: 1337); |
| 12 | fprintf(stderr, format: "Test alloc: %p.\n" , p); |
| 13 | __lsan_ignore_object(p); |
| 14 | __lsan_ignore_object(p); |
| 15 | free(ptr: p); |
| 16 | __lsan_ignore_object(p); |
| 17 | return 0; |
| 18 | } |
| 19 | // CHECK: Test alloc: [[ADDR:.*]]. |
| 20 | // CHECK-NOT: SUMMARY: {{.*}} leaked |
| 21 | |