From a283f65a081238a89c83b01ef3f768e42ea03775 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 23 Aug 1996 09:33:32 +0000 Subject: [PATCH] Fix a couple of file-descriptor leaks. --- usr.bin/ftp/ftp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index fd091b4613b..6b499c43aff 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1015,6 +1015,7 @@ initconn() perror("ftp: setsockopt (ignored)"); if (command("PASV") != COMPLETE) { printf("Passive mode refused.\n"); + close(data); return(1); } @@ -1029,6 +1030,7 @@ initconn() if (sscanf(pasv,"%d,%d,%d,%d,%d,%d",&a1,&a2,&a3,&a4,&p1,&p2) != 6) { printf("Passive mode address scan failure. Shouldn't happen!\n"); + close(data); return(1); }; @@ -1040,6 +1042,7 @@ initconn() if (connect(data, (struct sockaddr *) &data_addr, sizeof(data_addr))<0) { perror("ftp: connect"); + close(data); return(1); } #ifdef IP_TOS -- 2.45.2