From: Eugene Syromiatnikov Date: Mon, 11 Aug 2025 08:56:13 +0000 (+0200) Subject: Remove OSSL_CRYPTO_ALLOC attribute from CRYPTO_*dup routines X-Git-Tag: openssl-3.4.3~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afd9b9f7c9863fd60e6d90baef1a2bed9cb6f64c;p=thirdparty%2Fopenssl.git Remove OSSL_CRYPTO_ALLOC attribute from CRYPTO_*dup routines The __attribute__((malloc)) is for functions that return new memory, and "the memory [returned by the function] has undefined content", which is a property that doesn't hold for the *dup functions (the same reason it doesn't apply to realloc). Fixes: e1035957eba1 "OSSL_CRYPTO_ALLOC attribute introduction proposal." Signed-off-by: Eugene Syromiatnikov Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/28220) (cherry picked from commit 85bba74789f82daca7482a9274c6d02843fb2dbb) --- diff --git a/include/openssl/crypto.h.in b/include/openssl/crypto.h.in index 101719ab5b3..cc80605a3db 100644 --- a/include/openssl/crypto.h.in +++ b/include/openssl/crypto.h.in @@ -335,9 +335,9 @@ OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, const char *file, int line); OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc(size_t num, size_t align, void **freeptr, const char *file, int line); -OSSL_CRYPTO_ALLOC void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); -OSSL_CRYPTO_ALLOC char *CRYPTO_strdup(const char *str, const char *file, int line); -OSSL_CRYPTO_ALLOC char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); +void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); void CRYPTO_free(void *ptr, const char *file, int line); void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);