diff --git a/lib/ftp.c b/lib/ftp.c index 8b347e34fd..5bf44f1180 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