/src/libspdm/os_stub/malloclib/malloclib.c
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * Copyright Notice: |
3 | | * Copyright 2021-2022 DMTF. All rights reserved. |
4 | | * License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md |
5 | | **/ |
6 | | |
7 | | #include <base.h> |
8 | | |
9 | | #include <stdio.h> |
10 | | #include <stdlib.h> |
11 | | #include <string.h> |
12 | | #include <assert.h> |
13 | | |
14 | | void *allocate_pool(size_t AllocationSize) |
15 | 731 | { |
16 | 731 | return malloc(AllocationSize); |
17 | 731 | } |
18 | | |
19 | | void *allocate_zero_pool(size_t AllocationSize) |
20 | 74.4M | { |
21 | 74.4M | void *buffer; |
22 | 74.4M | buffer = malloc(AllocationSize); |
23 | 74.4M | if (buffer == NULL) { |
24 | 0 | return NULL; |
25 | 0 | } |
26 | 74.4M | memset(buffer, 0, AllocationSize); |
27 | 74.4M | return buffer; |
28 | 74.4M | } |
29 | | |
30 | | void free_pool(void *buffer) |
31 | 74.3M | { |
32 | 74.3M | free(buffer); |
33 | 74.3M | } |