]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh2: use the Curl_* memory functions to avoid memdebug
authorDaniel Stenberg <daniel@haxx.se>
Fri, 20 Sep 2024 15:27:26 +0000 (17:27 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 20 Sep 2024 20:47:18 +0000 (22:47 +0200)
This prevents our torture tests from detecting and getting trapped by
memory leaks in libssh2.

Closes #14984

lib/vssh/libssh2.c

index 96c6f04706ec416297870ecb2efdf15620c01a95..1ea356f9e5d23081181133b32d23910b775a6101 100644 (file)
@@ -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);
 }
 
 /*