[PATCH] http: use xmalloc with cURL

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

 



f0ed8226c9 (Add custom memory allocator to MinGW and MacOS builds, 2009-05-31)
never told cURL about it.

Correct that by using the cURL initializer available since version 7.12 to
point to xmalloc and friends for consistency which then will pass the
allocation requests along when USE_NED_ALLOCATOR=YesPlease is used (most
likely in Windows)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
---
This doesn't conflict with anything and was originally based on maint (so it
applies cleanly also to master and next), but is now rebased on top of
jk/drop-release-pack-memory so the final product wouldn't have any chance to
introduce problems (thanks Peff)

it has been built and tested in Windows through Azure Pipelines (thanks Dscho)
and shouldn't introduce any build problems even with ancient versions or cURL
(thanks Daniel) and while not strictly needed is a nice thing to have for
consistency (thanks Junio)

 http.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/http.h b/http.h
index b429f1cf04..e5f075dcbf 100644
--- a/http.h
+++ b/http.h
@@ -22,9 +22,15 @@
 #define DEFAULT_MAX_REQUESTS 5
 #endif
 
+#if LIBCURL_VERSION_NUM >= 0x070c00
+#define curl_global_init(a) curl_global_init_mem(a, xmalloc, free, \
+						xrealloc, xstrdup, xcalloc)
+#endif
+
 #if LIBCURL_VERSION_NUM < 0x070704
 #define curl_global_cleanup() do { /* nothing */ } while (0)
 #endif
+
 #if LIBCURL_VERSION_NUM < 0x070800
 #define curl_global_init(a) do { /* nothing */ } while (0)
 #endif

base-commit: 9827d4c185e4da728f51cd77c54a38c9de62495f
-- 
2.23.0.rc2




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux