2021-08-07  Bruno Haible  <[email protected]>

        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