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 | |
13 | int main() { |
14 | void *P = malloc(size: ALLOC_SIZE); |
15 | if (P == nullptr) { |
16 | return 1; |
17 | } |
18 | |
19 | free(ptr: P); |
20 | |
21 | P = calloc(nmemb: 4, size: ALLOC_SIZE); |
22 | if (P == nullptr) { |
23 | return 2; |
24 | } |
25 | |
26 | P = realloc(ptr: P, size: ALLOC_SIZE * 8); |
27 | if (P == nullptr) { |
28 | return 3; |
29 | } |
30 | |
31 | free(ptr: P); |
32 | |
33 | P = aligned_alloc(alignment: 64, size: ALLOC_SIZE); |
34 | if (P == nullptr) { |
35 | return 4; |
36 | } |
37 | |
38 | free(ptr: P); |
39 | |
40 | return 0; |
41 | } |
42 | |