This attribute helps avoid memory leaks.
Link: <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute>
Cc: Liam Crilly <liam@nginx.com>
Cc: Zhidao Hong <z.hong@f5.com>
Signed-off-by: Alejandro Colomar <alx@nginx.com>
---
src/njs_clang.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/njs_clang.h b/src/njs_clang.h
index 614b509..c52d75a 100644
--- a/src/njs_clang.h
+++ b/src/njs_clang.h
@@ -155,10 +155,12 @@ njs_leading_zeros64(uint64_t x)
#if (NJS_HAVE_GCC_ATTRIBUTE_MALLOC)
-#define NJS_MALLOC_LIKE __attribute__((__malloc__))
+#define NJS_MALLOC_LIKE __attribute__((__malloc__))
+#define NJS_MALLOC(deallocator) __attribute__((__malloc__(deallocator)))
#else
#define NJS_MALLOC_LIKE
+#define NJS_MALLOC(deallocator)
#endif
--
2.39.0
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel