bug-gnulib
[Top][All Lists]
Advanced

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

readline: Improve GCC 11 allocation-deallocation checking


From: Bruno Haible
Subject: readline: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 21:56:51 +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>

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

diff --git a/lib/readline.h b/lib/readline.h
index 57acdf7..e4b6f9b 100644
--- a/lib/readline.h
+++ b/lib/readline.h
@@ -24,11 +24,13 @@
 # include <stdio.h>
 # include <readline/readline.h>
 #else
+# include <stdlib.h>
 /* Prints a prompt PROMPT and then reads and returns a single line of
    text from the user.  If PROMPT is NULL or the empty string, no
    prompt is displayed.  The returned line is allocated with malloc;
    the caller should free the line when it has finished with it. */
-extern char *readline (const char *prompt);
+extern char *readline (const char *prompt)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 #endif
 
 #endif /* GL_READLINE_H */




reply via email to

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