bug-gnulib
[Top][All Lists]
Advanced

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

canon-host: Improve GCC 11 allocation-deallocation checking


From: Bruno Haible
Subject: canon-host: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:21:49 +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>

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

diff --git a/lib/canon-host.h b/lib/canon-host.h
index fb35bfe..2891925 100644
--- a/lib/canon-host.h
+++ b/lib/canon-host.h
@@ -20,8 +20,12 @@
 #ifndef CANON_HOST_H
 # define CANON_HOST_H 1
 
-char *canon_host (char const *host) _GL_ATTRIBUTE_MALLOC;
-char *canon_host_r (char const *host, int *cherror) _GL_ATTRIBUTE_MALLOC;
+# include <stdlib.h>
+
+char *canon_host (char const *host)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
+char *canon_host_r (char const *host, int *cherror)
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 const char *ch_strerror (void);
 # define ch_strerror_r(cherror) gai_strerror (cherror);




reply via email to

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