2021-08-07 Bruno Haible <[email protected]> read-file: Improve GCC 11 allocation-deallocation checking. * lib/read-file.h: Include <stdlib.h> instead of <stddef.h>. (fread_file, read_file): Declare that deallocation must happen through 'free'.
diff --git a/lib/read-file.h b/lib/read-file.h index 9a96684..688f802 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 <stddef.h> +/* Get size_t, free(). */ +#include <stdlib.h> /* Get FILE. */ #include <stdio.h> @@ -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 */
