mirror of
https://github.com/curl/curl.git
synced 2026-05-30 10:17:28 +03:00
libssh2: fix memory leak in SSH_SFTP_REALPATH state
Seen in MSVC libssh2 CI job: ``` test 0615...[SFTP put remote failure] test 0616...[SFTP retrieval of empty file] test 0618...[SFTP retrieval of two files] test 0620...[SFTP retrieval of missing file followed by good file] test 0622...[SFTP put failure] test 0637...[SFTP retrieval with invalid X- range] test 0640...[SFTP --head retrieval] ** MEMORY FAILURE Leak detected: memory still allocated: 22 bytes At 2ae5b8a7ab8, there's 22 bytes. allocated by D:/a/curl/curl/lib/vssh/libssh2.c:2006 ``` https://github.com/curl/curl/actions/runs/13752652590/job/38455575042?pr=16636#step:14:3907 https://github.com/curl/curl/actions/runs/13752879003/job/38456075461 https://github.com/curl/curl/actions/runs/13753706458/job/38457888479 Bug: https://github.com/curl/curl/pull/16636#issuecomment-2709086838 Co-authored-by: Daniel Stenberg Closes #16639
This commit is contained in:
parent
61d30615e4
commit
30739b4d36
2 changed files with 1 additions and 2 deletions
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
|
|
@ -926,8 +926,6 @@ jobs:
|
|||
TFLAGS+=' ~612' # SFTP
|
||||
if [[ '${{ matrix.install }}' = *'libssh2[core,zlib]'* ]]; then
|
||||
TFLAGS+=' ~SFTP'
|
||||
elif [[ '${{ matrix.install }}' = *'libssh2'* ]]; then
|
||||
TFLAGS+=' ~615 ~616 ~618 ~620 ~622' # Leak detected: memory still allocated: 22 bytes, allocated by D:/a/curl/curl/lib/vssh/libssh2.c:2006, sshc->homedir = strdup(sshp->readdir_filename);
|
||||
elif [[ '${{ matrix.install }}' = *'libssh '* ]]; then
|
||||
TFLAGS+=' ~614' # 'SFTP pre-quote chmod' SFTP, pre-quote, directory
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2003,6 +2003,7 @@ static CURLcode ssh_statemachine(struct Curl_easy *data, bool *block)
|
|||
if(rc > 0) {
|
||||
/* It seems that this string is not always NULL terminated */
|
||||
sshp->readdir_filename[rc] = '\0';
|
||||
free(sshc->homedir);
|
||||
sshc->homedir = strdup(sshp->readdir_filename);
|
||||
if(!sshc->homedir) {
|
||||
state(data, SSH_SFTP_CLOSE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue