aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-08-31 03:50:07 +0200
committerYang Tse <yangsita@gmail.com>2011-08-31 03:50:07 +0200
commitd20408e8161a55b8408a47a33d89ee8d37b6e146 (patch)
treebf10e70d9463fda65ddb3b9a81e4dc008652e840 /lib/ftp.c
parentc06de200252fedc348af27ad9de9893d7c0a9a4d (diff)
fix some leaks torture tests detected 2011-08-30
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 43a72eb05..538873a10 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -999,8 +999,10 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd],
sa->sa_family == AF_INET?1:2,
myhost, port);
- if(result)
+ if(result) {
+ Curl_closesocket(conn, portsock);
return result;
+ }
break;
}
else if(PORT == fcmd) {
@@ -1020,8 +1022,10 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
snprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
- if(result)
+ if(result) {
+ Curl_closesocket(conn, portsock);
return result;
+ }
break;
}
}