From: Bruno Haible Date: Sat, 7 Aug 2021 19:52:48 +0000 (+0200) Subject: read-file: Improve GCC 11 allocation-deallocation checking. X-Git-Tag: v1.0~2695 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ce3c801be1caa4651c788e8058c509d5e4e94d99;p=gnulib.git read-file: Improve GCC 11 allocation-deallocation checking. * lib/read-file.h: Include instead of . (fread_file, read_file): Declare that deallocation must happen through 'free'. --- diff --git a/ChangeLog b/ChangeLog index 8d4f2fda64..baaad7c76a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-08-07 Bruno Haible + + read-file: Improve GCC 11 allocation-deallocation checking. + * lib/read-file.h: Include instead of . + (fread_file, read_file): Declare that deallocation must happen through + 'free'. + 2021-08-07 Bruno Haible pipe-filter-gi: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/read-file.h b/lib/read-file.h index 9a96684307..688f802831 100644 --- a/lib/read-file.h +++ b/lib/read-file.h @@ -18,8 +18,8 @@ #ifndef READ_FILE_H #define READ_FILE_H -/* Get size_t. */ -#include +/* Get size_t, free(). */ +#include /* Get FILE. */ #include @@ -30,8 +30,10 @@ /* Indicate that the file content contains sensitive information. */ #define RF_SENSITIVE 0x2 -extern char *fread_file (FILE * stream, int flags, size_t * length); +extern char *fread_file (FILE * stream, int flags, size_t * length) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; -extern char *read_file (const char *filename, int flags, size_t * length); +extern char *read_file (const char *filename, int flags, size_t * length) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; #endif /* READ_FILE_H */