From 4a49d74ac8762e8b0bfe0b87ef386fde0fa63d73 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 7 Aug 2021 22:08:16 +0200 Subject: [PATCH] striconv: Improve GCC 11 allocation-deallocation checking. * lib/striconv.h: Include instead of . (str_cd_iconv, str_iconv): Declare that deallocation must happen through 'free'. --- ChangeLog | 7 +++++++ lib/striconv.h | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89e3f5551d..3d25b03018 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-08-07 Bruno Haible + + striconv: Improve GCC 11 allocation-deallocation checking. + * lib/striconv.h: Include instead of . + (str_cd_iconv, str_iconv): Declare that deallocation must happen through + 'free'. + 2021-08-07 Bruno Haible relocatable-lib-lgpl: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/striconv.h b/lib/striconv.h index 69da35d2d8..c192ee165d 100644 --- a/lib/striconv.h +++ b/lib/striconv.h @@ -18,7 +18,7 @@ #ifndef _STRICONV_H #define _STRICONV_H -#include +#include #if HAVE_ICONV #include #endif @@ -52,7 +52,8 @@ extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, Allocate a malloced memory block for the result. Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ -extern char * str_cd_iconv (const char *src, iconv_t cd); +extern char * str_cd_iconv (const char *src, iconv_t cd) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif @@ -64,7 +65,8 @@ extern char * str_cd_iconv (const char *src, iconv_t cd); Return value: the freshly allocated resulting NUL-terminated string if successful, otherwise NULL and errno set. */ extern char * str_iconv (const char *src, - const char *from_codeset, const char *to_codeset); + const char *from_codeset, const char *to_codeset) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #ifdef __cplusplus -- 2.39.5