From b81d51e9049762bfc3280118ff04cb5d47297941 Mon Sep 17 00:00:00 2001 From: Eshan Kelkar Date: Tue, 27 May 2025 20:38:12 +0530 Subject: [PATCH] libssh: Remove free done for sftp_send_aio for successful write libssh's sftp_aio_wait_write() would free the sftp_aio and assign NULL to the variable storing it in case of success and error (not in case of SSH_AGAIN). Hence freeing sftp_send_aio and assigning it NULL is not needed in case of successful sftp_aio_wait_write() due to which this commit removes that code. Signed-off-by: Eshan Kelkar --- lib/vssh/libssh.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index f433f7eaab..d8e03e7ab1 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -3047,10 +3047,13 @@ static CURLcode sftp_send(struct Curl_easy *data, int sockindex, return CURLE_AGAIN; else if(nwrite < 0) return CURLE_SEND_ERROR; - if(sshc->sftp_send_aio) { - sftp_aio_free(sshc->sftp_send_aio); - sshc->sftp_send_aio = NULL; - } + + /* + * sftp_aio_wait_write() would free sftp_send_aio and + * assign it NULL in all cases except when it returns + * SSH_AGAIN. + */ + sshc->sftp_send_state = 0; *pnwritten = (size_t)nwrite; return CURLE_OK;