]> 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:02:18 +0000 (15:02 -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 e0ace5e5a064c6aff73dc40d8edce592b49f511c..179a3076d1c2de60926bcefe74b26e36ecc52557 100644 (file)
@@ -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);