]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove OSSL_CRYPTO_ALLOC attribute from CRYPTO_*dup routines
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 11 Aug 2025 08:56:13 +0000 (10:56 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 12 Aug 2025 19:06:56 +0000 (15:06 -0400)
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 <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28220)

(cherry picked from commit 85bba74789f82daca7482a9274c6d02843fb2dbb)

include/openssl/crypto.h.in

index b2d691b90f0ec2ffea36b7e4a5eb75816afc3853..53efc5657cacaae9167e0a6846042f2187756951 100644 (file)
@@ -321,9 +321,9 @@ void CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,
 
 OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);
 OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, 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);