mirror of
https://github.com/curl/curl.git
synced 2025-09-11 22:52:42 +03:00
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
This commit is contained in:
parent
5895b71b0e
commit
876047d1c3
|
@ -279,23 +279,27 @@ static CURLcode libssh2_session_error_to_CURLE(int err)
|
||||||
return CURLE_SSH;
|
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)
|
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)
|
||||||
{
|
{
|
||||||
(void)abstract; /* arg not used */
|
(void)abstract; /* arg not used */
|
||||||
return malloc(count);
|
return Curl_cmalloc(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc)
|
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc)
|
||||||
{
|
{
|
||||||
(void)abstract; /* arg not used */
|
(void)abstract; /* arg not used */
|
||||||
return realloc(ptr, count);
|
return Curl_crealloc(ptr, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LIBSSH2_FREE_FUNC(my_libssh2_free)
|
static LIBSSH2_FREE_FUNC(my_libssh2_free)
|
||||||
{
|
{
|
||||||
(void)abstract; /* arg not used */
|
(void)abstract; /* arg not used */
|
||||||
if(ptr) /* ssh2 agent sometimes call free with null ptr */
|
if(ptr) /* ssh2 agent sometimes call free with null ptr */
|
||||||
free(ptr);
|
Curl_cfree(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user