diff options
author | tb <> | 2024-03-02 11:35:09 +0000 |
---|---|---|
committer | tb <> | 2024-03-02 11:35:09 +0000 |
commit | 0e0cb92067894b44c4616c0ca3622a555adf404c (patch) | |
tree | f4dbee84a23329e7ce15123ae094c7df149b039e /src/lib/libcrypto/malloc-wrapper.c | |
parent | 2ebc8c867d962934d7ca505b4686cb67359ed825 (diff) | |
download | openbsd-0e0cb92067894b44c4616c0ca3622a555adf404c.tar.gz openbsd-0e0cb92067894b44c4616c0ca3622a555adf404c.tar.bz2 openbsd-0e0cb92067894b44c4616c0ca3622a555adf404c.zip |
Fix CRYPTO_malloc/free signatures
Importantly, the size in malloc is now a size_t instead of an int. The API
now also takes a file and line to match upstream's signature.
ok jsing
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/malloc-wrapper.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/malloc-wrapper.c b/src/lib/libcrypto/malloc-wrapper.c index e13cc23373..fb42169b2f 100644 --- a/src/lib/libcrypto/malloc-wrapper.c +++ b/src/lib/libcrypto/malloc-wrapper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc-wrapper.c,v 1.9 2024/03/02 11:28:46 tb Exp $ */ | 1 | /* $OpenBSD: malloc-wrapper.c,v 1.10 2024/03/02 11:35:09 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Bob Beck | 3 | * Copyright (c) 2014 Bob Beck |
4 | * | 4 | * |
@@ -37,10 +37,8 @@ CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), | |||
37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); | 37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); |
38 | 38 | ||
39 | void * | 39 | void * |
40 | CRYPTO_malloc(int num, const char *file, int line) | 40 | CRYPTO_malloc(size_t num, const char *file, int line) |
41 | { | 41 | { |
42 | if (num <= 0) | ||
43 | return NULL; | ||
44 | return malloc(num); | 42 | return malloc(num); |
45 | } | 43 | } |
46 | 44 | ||
@@ -51,7 +49,7 @@ CRYPTO_strdup(const char *str, const char *file, int line) | |||
51 | } | 49 | } |
52 | 50 | ||
53 | void | 51 | void |
54 | CRYPTO_free(void *ptr) | 52 | CRYPTO_free(void *ptr, const char *file, int line) |
55 | { | 53 | { |
56 | free(ptr); | 54 | free(ptr); |
57 | } | 55 | } |