summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-03-12 16:15:13 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-03-12 19:53:05 +0100
commit8ed71fc4f7116288da75ed85e21fe8c53f4cdfb2 (patch)
treecf19c3ffece191e95baf8021211e7cba085641a5
parentd1f40078c13e85c56332dcb7f908fe2a7b65eb22 (diff)
downloadcurl-8ed71fc4f7116288da75ed85e21fe8c53f4cdfb2.tar.gz
ftp: fix memory leak in ftp_done
If after a transfer is complete Curl_GetFTPResponse() returns an error, curl would not free the ftp->pathalloc block. Found by torture-testing test 576 Closes #6737
-rw-r--r--lib/ftp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 8b347e34f..5bf44f118 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3325,8 +3325,10 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
connclose(conn, "Timeout or similar in FTP DONE operation"); /* close */
}
- if(result)
+ if(result) {
+ Curl_safefree(ftp->pathalloc);
return result;
+ }
if(ftpc->dont_check && data->req.maxdownload > 0) {
/* we have just sent ABOR and there is no reliable way to check if it was