From 72ec85aef0ad111d5a0c73e38caef3ed01516fb0 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 7 Aug 2021 22:02:37 +0200
Subject: [PATCH] regex-quote: Improve GCC 11 allocation-deallocation checking.

* lib/regex-quote.h: Include <stdlib.h> instead of <stddef.h>.
(regex_quote): Declare that deallocation must happen through 'free'.
---
 ChangeLog         | 6 ++++++
 lib/regex-quote.h | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8ce06c44db..ac96080531 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+	regex-quote: Improve GCC 11 allocation-deallocation checking.
+	* lib/regex-quote.h: Include <stdlib.h> instead of <stddef.h>.
+	(regex_quote): Declare that deallocation must happen through 'free'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
 	readline: Improve GCC 11 allocation-deallocation checking.
diff --git a/lib/regex-quote.h b/lib/regex-quote.h
index 470393eb8f..9e8e694375 100644
--- a/lib/regex-quote.h
+++ b/lib/regex-quote.h
@@ -18,8 +18,8 @@
 #ifndef _REGEX_QUOTE_H
 #define _REGEX_QUOTE_H
 
-#include <stddef.h>
 #include <stdbool.h>
+#include <stdlib.h>
 
 
 /* Specifies a quotation task for converting a fixed string to a regular
@@ -82,7 +82,9 @@ extern char *
 
 /* Returns the freshly allocated quoted string.  */
 extern char *
-       regex_quote (const char *string, const struct regex_quote_spec *spec);
+       regex_quote (const char *string, const struct regex_quote_spec *spec)
+       _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+       _GL_ATTRIBUTE_RETURNS_NONNULL;
 
 
 #endif /* _REGEX_QUOTE_H */
-- 
2.39.5