From 359e5c6cb128dab64ea6070d21d1c240f96cea6b Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 11 Sep 2023 18:53:31 +0300 Subject: Remove incorrect uses of __attribute__((__malloc__)). xrealloc() is obviously incorrect, modern GCC docs even mention realloc() as an example where this attribute cannot be used. liblzma's lzma_alloc() and lzma_alloc_zero() would be correct uses most of the time but custom allocators may use a memory pool or otherwise hold the pointer so aliasing issues could happen in theory. The xstrdup() case likely was correct but I removed it anyway. Now there are no __malloc__ attributes left in the code. The allocations aren't in hot paths so this should make no practical difference. --- src/liblzma/common/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/liblzma/common/common.h') diff --git a/src/liblzma/common/common.h b/src/liblzma/common/common.h index 4d9cab53..cea9f9b3 100644 --- a/src/liblzma/common/common.h +++ b/src/liblzma/common/common.h @@ -298,12 +298,12 @@ struct lzma_internal_s { /// Allocates memory extern void *lzma_alloc(size_t size, const lzma_allocator *allocator) - lzma_attribute((__malloc__)) lzma_attr_alloc_size(1); + lzma_attr_alloc_size(1); /// Allocates memory and zeroes it (like calloc()). This can be faster /// than lzma_alloc() + memzero() while being backward compatible with /// custom allocators. -extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1) +extern void * lzma_attr_alloc_size(1) lzma_alloc_zero(size_t size, const lzma_allocator *allocator); /// Frees memory -- cgit v1.2.3