bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 13/27] savedir: improve -fanalyzer malloc checking


From: Paul Eggert
Subject: [PATCH 13/27] savedir: improve -fanalyzer malloc checking
Date: Sun, 1 Aug 2021 18:18:07 -0700

---
 ChangeLog     | 2 +-
 lib/savedir.h | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 11c4395b9..45fd8cad5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,7 @@
        * lib/canonicalize.h, lib/dfa.h, lib/dirname.h, lib/exclude.h:
        * lib/filenamecat.h, lib/malloca.h, lib/modechange.h:
        * lib/mountlist.h, lib/pagealign_alloc.h, lib/quotearg.h:
-       * lib/readutmp.h:
+       * lib/readutmp.h, lib/savedir.h:
        Add malloc-related attributes and include stdlib.h as needed.
        * lib/dfa.c: Include verify.h.
        (assume_nonnull): New macro.
diff --git a/lib/savedir.h b/lib/savedir.h
index 65cc15af1..12dabdb11 100644
--- a/lib/savedir.h
+++ b/lib/savedir.h
@@ -22,6 +22,7 @@
 #define _GL_SAVEDIR_H
 
 #include <dirent.h>
+#include <stdlib.h>
 
 enum savedir_option
   {
@@ -35,7 +36,9 @@ enum savedir_option
 #endif
   };
 
-char *streamsavedir (DIR *, enum savedir_option);
-char *savedir (char const *, enum savedir_option);
+char *streamsavedir (DIR *, enum savedir_option)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *savedir (char const *, enum savedir_option)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 #endif
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]