]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp: improve -fanalyzer malloc checking
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2021 00:40:30 +0000 (17:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2021 01:06:56 +0000 (18:06 -0700)
ChangeLog
lib/readutmp.h

index 8a3dcb388576d97312b1e8d8e68c8078eea9e90b..11c4395b9618c0fbe762c75e53a967726d7fe5fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +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:
        Add malloc-related attributes and include stdlib.h as needed.
        * lib/dfa.c: Include verify.h.
        (assume_nonnull): New macro.
index a3a7eda01cad4eb8827642841fce41abe3bce85f..5be9818029e8728eb9f68d21956f2998e5bf6037 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef __READUTMP_H__
 # define __READUTMP_H__
 
+# include <stdlib.h>
 # include <sys/types.h>
 
 /* AIX 4.3.3 has both utmp.h and utmpx.h, but only struct utmp
@@ -211,7 +212,9 @@ enum
     READ_UTMP_USER_PROCESS = 2
   };
 
-char *extract_trimmed_name (const STRUCT_UTMP *ut);
+char *extract_trimmed_name (const STRUCT_UTMP *ut)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
 
 /* FIXME: This header should use idx_t, not size_t.  */
 int read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,