diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2023-09-11 18:53:31 +0300 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-10-31 01:03:25 +0800 |
commit | 359e5c6cb128dab64ea6070d21d1c240f96cea6b (patch) | |
tree | ca4bdd6a809e02378a860dbefcf6b13d43d0150b /src/xz/util.h | |
parent | Update THANKS. (diff) | |
download | xz-359e5c6cb128dab64ea6070d21d1c240f96cea6b.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | src/xz/util.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xz/util.h b/src/xz/util.h index 4a536f52..3fac8961 100644 --- a/src/xz/util.h +++ b/src/xz/util.h @@ -20,11 +20,11 @@ /// \brief Safe realloc() that never returns NULL extern void *xrealloc(void *ptr, size_t size) - lzma_attribute((__malloc__)) lzma_attr_alloc_size(2); + lzma_attr_alloc_size(2); /// \brief Safe strdup() that never returns NULL -extern char *xstrdup(const char *src) lzma_attribute((__malloc__)); +extern char *xstrdup(const char *src); /// \brief Fancy version of strtoull() |