]> Savannah Git Hosting - gnulib.git/commitdiff
read-file: Improve GCC 11 allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 19:52:48 +0000 (21:52 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 19:52:48 +0000 (21:52 +0200)
* lib/read-file.h: Include <stdlib.h> instead of <stddef.h>.
(fread_file, read_file): Declare that deallocation must happen through
'free'.

ChangeLog
lib/read-file.h

index 8d4f2fda64e7a53397e801399d5fce2dc8ae40c6..baaad7c76a62c18787aefa36b22a50497258ce19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       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'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        pipe-filter-gi: Improve GCC 11 allocation-deallocation checking.
index 9a966843079deab2801f27a4d516f9f69f0dde1d..688f802831501f0b583133eb6481ba22937df5f0 100644 (file)
@@ -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>
 /* 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 */