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

index aba2b150d65a9bf9c89715fd8961649a5a219978..b1b6b4296c161fe71d96a4a51957e327cc91d516 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,7 @@
        * lib/mountlist.h, lib/pagealign_alloc.h, lib/quotearg.h:
        * lib/readutmp.h, lib/savedir.h, lib/sh-quote.h, lib/system-quote.h:
        * lib/trim.h, lib/xgetcwd.h, lib/xgethostname.h, lib/xmalloca.h:
-       * lib/xreadlink.h, lib/xstriconv.h:
+       * lib/xreadlink.h, lib/xstriconv.h, lib/xvasprintf.h:
        Add malloc-related attributes and include stdlib.h as needed.
        * lib/dfa.c: Include verify.h.
        (assume_nonnull): New macro.
index 4da42c6554319b3c6f56f8e78e08f30c7d7e70f1..aaa7ade550395a5ebcf4c365b280cdfceebacd00 100644 (file)
@@ -23,6 +23,9 @@
 /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD.  */
 #include <stdio.h>
 
+/* Get 'free'.  */
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -35,8 +38,10 @@ extern "C" {
      - [EILSEQ] error during conversion between wide and multibyte characters,
    return NULL.  */
 extern char *xasprintf (const char *format, ...)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
        _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2));
 extern char *xvasprintf (const char *format, va_list args)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
        _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0));
 
 #ifdef __cplusplus