xref: /llvm-project/compiler-rt/test/lsan/TestCases/user_pointer.cpp (revision 51e49e12e7cbbd195b4a97c55860858d9eddce58)
1 // Checks if a user pointer is found by the leak sanitizer.
2 // RUN: %clang_lsan %s -o %t
3 // RUN: %run %t 2>&1
4 
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 
9 uintptr_t glob[1024];
10 
main()11 int main() {
12   for (int i = 0; i < 1024; ++i) {
13     // Check that the pointers will not be falsely reported as leaks.
14     glob[i] = (uintptr_t)malloc(sizeof(int *));
15   }
16   return 0;
17 }
18