bug-gnulib
[Top][All Lists]
Advanced

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

[x]concat-filename: Improve GCC 11 allocation-deallocation checking


From: Bruno Haible
Subject: [x]concat-filename: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:27:58 +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>

        [x]concat-filename: Improve GCC 11 allocation-deallocation checking.
        * lib/concat-filename.h: Include <stdlib.h>.
        (concatenated_filename, xconcatenated_filename): Declare that
        deallocation must happen through 'free'.

diff --git a/lib/concat-filename.h b/lib/concat-filename.h
index 5a7d393..32a437e 100644
--- a/lib/concat-filename.h
+++ b/lib/concat-filename.h
@@ -17,6 +17,8 @@
 #ifndef _CONCAT_FILENAME_H
 #define _CONCAT_FILENAME_H
 
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -26,12 +28,15 @@ extern "C" {
    suffix.  Return a freshly allocated filename.  Return NULL and set errno
    upon memory allocation failure.  */
 extern char *concatenated_filename (const char *directory,
-                                    const char *filename, const char *suffix);
+                                    const char *filename, const char *suffix)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 /* Concatenate a directory filename, a relative filename and an optional
    suffix.  Return a freshly allocated filename.  */
 extern char *xconcatenated_filename (const char *directory,
-                                     const char *filename, const char *suffix);
+                                     const char *filename, const char *suffix)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+  _GL_ATTRIBUTE_RETURNS_NONNULL;
 
 
 #ifdef __cplusplus




reply via email to

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