bug-gnulib
[Top][All Lists]
Advanced

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

get_progname_of: Improve GCC 11 allocation-deallocation checking


From: Bruno Haible
Subject: get_progname_of: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:38:01 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

2021-08-07  Bruno Haible  <bruno@clisp.org>

        get_progname_of: Improve GCC 11 allocation-deallocation checking.
        * lib/get_progname_of.h: Include <stdlib.h>.
        (get_progname_of): Declare that deallocation must happen through 'free'.

diff --git a/lib/get_progname_of.h b/lib/get_progname_of.h
index 9270301..a466214 100644
--- a/lib/get_progname_of.h
+++ b/lib/get_progname_of.h
@@ -18,6 +18,7 @@
 #ifndef _GET_PROGNAME_OF_H
 #define _GET_PROGNAME_OF_H
 
+#include <stdlib.h>
 #include <sys/types.h>
 
 #ifdef __cplusplus
@@ -27,7 +28,8 @@ extern "C" {
 /* Returns the base name of the program that executes the given process,
    possibly truncated, as a freshly allocated string, or NULL if it cannot
    be determined.  */
-extern char *get_progname_of (pid_t pid);
+extern char *get_progname_of (pid_t pid)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 #ifdef __cplusplus
 }




reply via email to

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