Debian Codegraph @

crt/aws-c-common/verification/cbmc/stubs/aws_string_destroy_override.c

raw symbols SCIP
1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/common/string.h>
7
8 /**
9 * Allocation/Deallocation using the standard aws-c-common allocators requires
10 * calls through function pointers. Until we get better function pointer support in
11 * CBMC, this is expensive. Instead, since we know we're using "malloc" to do allocation
12 * in CBMC proofs, we can just directly use "free" here, saving the function pointer derefences.
13 * Otherwise the same as the real function.
14 */
15 void aws_string_destroy(struct aws_string *str) {
16 AWS_PRECONDITION(!str || aws_string_is_valid(str));
17 /* If the string has no allocator, its a static string and can't be freed */
18 if (str && str->allocator) {
19 free(str);
20 }
21 }