From: Daniel Stenberg Date: Fri, 20 Sep 2024 15:27:26 +0000 (+0200) Subject: libssh2: use the Curl_* memory functions to avoid memdebug X-Git-Tag: curl-8_11_0~396 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=876047d1c34488b8492ca73cdbd22c01cffea9f9;p=thirdparty%2Fcurl.git libssh2: use the Curl_* memory functions to avoid memdebug This prevents our torture tests from detecting and getting trapped by memory leaks in libssh2. Closes #14984 --- diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 96c6f04706..1ea356f9e5 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -279,23 +279,27 @@ static CURLcode libssh2_session_error_to_CURLE(int err) return CURLE_SSH; } +/* These functions are made to use the libcurl memory functions - NOT the + debugmem functions, as that leads us to trigger on libssh2 memory leaks + that are not ours to care for */ + static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc) { (void)abstract; /* arg not used */ - return malloc(count); + return Curl_cmalloc(count); } static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc) { (void)abstract; /* arg not used */ - return realloc(ptr, count); + return Curl_crealloc(ptr, count); } static LIBSSH2_FREE_FUNC(my_libssh2_free) { (void)abstract; /* arg not used */ if(ptr) /* ssh2 agent sometimes call free with null ptr */ - free(ptr); + Curl_cfree(ptr); } /*