From: Bruno Haible Date: Sat, 7 Aug 2021 21:08:45 +0000 (+0200) Subject: xmemdup0: Improve GCC 11 allocation-deallocation checking. X-Git-Tag: v1.0~2686 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5c2fcfe2817f9d148807fd00efc6214fe4aea0a5;p=gnulib.git xmemdup0: Improve GCC 11 allocation-deallocation checking. * lib/xmemdup0.h: Include instead of . (xmemdup0): Declare that deallocation must happen through 'free'. --- diff --git a/ChangeLog b/ChangeLog index 2a8bcf90e4..336da1deb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-08-07 Bruno Haible + + xmemdup0: Improve GCC 11 allocation-deallocation checking. + * lib/xmemdup0.h: Include instead of . + (xmemdup0): Declare that deallocation must happen through 'free'. + 2021-08-07 Bruno Haible windows-spawn: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/xmemdup0.h b/lib/xmemdup0.h index 4f3b581488..6e34348336 100644 --- a/lib/xmemdup0.h +++ b/lib/xmemdup0.h @@ -18,14 +18,16 @@ #ifndef XMEMDUP_H_ # define XMEMDUP_H_ -# include +# include # ifdef __cplusplus extern "C" { # endif -char *xmemdup0 (void const *p, size_t s); +char *xmemdup0 (void const *p, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE + _GL_ATTRIBUTE_RETURNS_NONNULL; # ifdef __cplusplus }