From ce3c801be1caa4651c788e8058c509d5e4e94d99 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 7 Aug 2021 21:52:48 +0200 Subject: [PATCH] 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'. --- ChangeLog | 7 +++++++ lib/read-file.h | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) 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 */ -- 2.39.5