]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libssh: properly free sftp_attributes
authorx2018 <xkernel.wang@foxmail.com>
Mon, 17 Nov 2025 10:36:42 +0000 (18:36 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 17 Nov 2025 13:40:39 +0000 (14:40 +0100)
Closes #19564

lib/vssh/libssh.c

index 8653c4901d39f03b052f0d00128678d09a30be14..9428a20a5f39b52ff261d4b52f5d54b8a8df6590 100644 (file)
@@ -1137,14 +1137,13 @@ static int myssh_in_UPLOAD_INIT(struct Curl_easy *data,
       attrs = sftp_stat(sshc->sftp_session, sshp->path);
       if(attrs) {
         curl_off_t size = attrs->size;
+        sftp_attributes_free(attrs);
         if(size < 0) {
           failf(data, "Bad file size (%" FMT_OFF_T ")", size);
           rc = myssh_to_ERROR(data, sshc, CURLE_BAD_DOWNLOAD_RESUME);
           return rc;
         }
-        data->state.resume_from = attrs->size;
-
-        sftp_attributes_free(attrs);
+        data->state.resume_from = size;
       }
       else {
         data->state.resume_from = 0;