mirror of
https://github.com/curl/curl.git
synced 2026-07-16 05:57:16 +03:00
ftp: fix socket leak on rare error
In the function AcceptServerConnect() the newly created socket would leak if Curl_conn_tcp_accepted_set() returns error. Which basically should never happen. Spotted by CodeSonar. Closes #13417
This commit is contained in:
parent
0a25b3e014
commit
b2523fc439
1 changed files with 3 additions and 1 deletions
|
|
@ -388,8 +388,10 @@ static CURLcode AcceptServerConnect(struct Curl_easy *data)
|
|||
(void)curlx_nonblock(s, TRUE); /* enable non-blocking */
|
||||
/* Replace any filter on SECONDARY with one listening on this socket */
|
||||
result = Curl_conn_tcp_accepted_set(data, conn, SECONDARYSOCKET, &s);
|
||||
if(result)
|
||||
if(result) {
|
||||
sclose(s);
|
||||
return result;
|
||||
}
|
||||
|
||||
if(data->set.fsockopt) {
|
||||
int error = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue