diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2017-02-25 22:55:46 +0100 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2017-02-25 22:55:46 +0100 |
commit | 516e60aa8e96c0b9a0364baa0f84a625e988b06f (patch) | |
tree | 5a51731bd7ba1bc86b5eef50062f241981add8f7 /lib/ftp.c | |
parent | eac0dc6a3fef627042d3ffc9f34fa5943e13c066 (diff) |
ftp: fixed a NULL pointer dereference on OOM
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -2040,11 +2040,14 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, /* this just dumps information about this second connection */ ftp_pasv_verbose(conn, addr->addr, ftpc->newhost, connectport); + Curl_resolv_unlock(data, addr); /* we're done using this address */ + Curl_safefree(conn->secondaryhostname); - conn->secondaryhostname = strdup(ftpc->newhost); conn->secondary_port = ftpc->newport; + conn->secondaryhostname = strdup(ftpc->newhost); + if(!conn->secondaryhostname) + return CURLE_OUT_OF_MEMORY; - Curl_resolv_unlock(data, addr); /* we're done using this address */ conn->bits.do_more = TRUE; state(conn, FTP_STOP); /* this phase is completed */ |