Home | History | Annotate | Download | only in TestCases
      1 // Test for incorrect use of __lsan_ignore_object().
      2 // RUN: %clangxx_lsan %s -o %t
      3 // RUN: LSAN_OPTIONS=$LSAN_BASE %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(1337);
     12   fprintf(stderr, "Test alloc: %p.\n", p);
     13   __lsan_ignore_object(p);
     14   __lsan_ignore_object(p);
     15   free(p);
     16   __lsan_ignore_object(p);
     17   return 0;
     18 }
     19 // CHECK: Test alloc: [[ADDR:.*]].
     20 // CHECK-NOT: SUMMARY: {{.*}} leaked
     21