xref: /aosp_15_r20/external/llvm-libc/test/integration/scudo/integration_test.cpp (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1 //===-- Integration Test for Scudo ----------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <stdlib.h>
10 
11 static const size_t ALLOC_SIZE = 128;
12 
main()13 int main() {
14   void *P = malloc(ALLOC_SIZE);
15   if (P == nullptr) {
16     return 1;
17   }
18 
19   free(P);
20 
21   P = calloc(4, ALLOC_SIZE);
22   if (P == nullptr) {
23     return 2;
24   }
25 
26   P = realloc(P, ALLOC_SIZE * 8);
27   if (P == nullptr) {
28     return 3;
29   }
30 
31   free(P);
32 
33   P = aligned_alloc(64, ALLOC_SIZE);
34   if (P == nullptr) {
35     return 4;
36   }
37 
38   free(P);
39 
40   return 0;
41 }
42