1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

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
This commit is contained in:
Daniel Stenberg 2021-03-12 16:15:13 +01:00
parent d1f40078c1
commit 8ed71fc4f7
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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