bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 01/27] backupfile: improve -fanalyzer malloc checking


From: Paul Eggert
Subject: [PATCH 01/27] backupfile: improve -fanalyzer malloc checking
Date: Sun, 1 Aug 2021 18:17:55 -0700

* lib/backup-internal.h, lib/backupfile.h:
Add malloc-related attributes and include stdlib.h as needed.
---
 ChangeLog             | 6 ++++++
 lib/backup-internal.h | 4 +++-
 lib/backupfile.h      | 9 +++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 21fbc52e3..f63846d2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       maint: improve -fanalyzer malloc checking
+       * lib/backup-internal.h, lib/backupfile.h:
+       Add malloc-related attributes and include stdlib.h as needed.
+
 2021-08-01  Jim Meyering  <meyering@fb.com>
 
        regex: pacify GCC 11.2.1's -fanalyzer
diff --git a/lib/backup-internal.h b/lib/backup-internal.h
index 701618220..863cc004e 100644
--- a/lib/backup-internal.h
+++ b/lib/backup-internal.h
@@ -17,5 +17,7 @@
 
 #include "backupfile.h"
 #include <stdbool.h>
+#include <stdlib.h>
 
-extern char *backupfile_internal (int, char const *, enum backup_type, bool);
+extern char *backupfile_internal (int, char const *, enum backup_type, bool)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
diff --git a/lib/backupfile.h b/lib/backupfile.h
index 349477064..fc77329fe 100644
--- a/lib/backupfile.h
+++ b/lib/backupfile.h
@@ -22,6 +22,8 @@
 /* Get AT_FDCWD, as a convenience for users of this file.  */
 #include <fcntl.h>
 
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -50,8 +52,11 @@ enum backup_type
 extern char const *simple_backup_suffix;
 
 void set_simple_backup_suffix (char const *);
-char *backup_file_rename (int, char const *, enum backup_type);
-char *find_backup_file_name (int, char const *, enum backup_type);
+char *backup_file_rename (int, char const *, enum backup_type)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *find_backup_file_name (int, char const *, enum backup_type)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
 enum backup_type get_version (char const *context, char const *arg);
 enum backup_type xget_version (char const *context, char const *arg);
 
-- 
2.31.1




reply via email to

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