X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fftp-basic.c;h=045d125e72d9136f955acc86ad0c5e6ca9d73212;hp=5084aae64c3c2e1e43da6aa64d1da7b468df53e1;hb=eee1589ef3d198a21635d15c9086df2b99f9013d;hpb=293008f682e5fa9726136bc121bceadc136c77dc diff --git a/src/ftp-basic.c b/src/ftp-basic.c index 5084aae6..045d125e 100644 --- a/src/ftp-basic.c +++ b/src/ftp-basic.c @@ -1,6 +1,7 @@ /* Basic FTP routines. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, + Inc. This file is part of GNU Wget. @@ -36,9 +37,7 @@ as that of the covered work. */ #include #include -#ifdef HAVE_UNISTD_H -# include -#endif +#include #include "utils.h" #include "connect.h" #include "host.h" @@ -525,7 +524,10 @@ ftp_pasv (int csock, ip_address *addr, int *port) for (s += 4; *s && !c_isdigit (*s); s++) ; if (!*s) - return FTPINVPASV; + { + xfree (respline); + return FTPINVPASV; + } for (i = 0; i < 6; i++) { tmp[i] = 0; @@ -594,7 +596,10 @@ ftp_lpsv (int csock, ip_address *addr, int *port) for (s += 4; *s && !c_isdigit (*s); s++) ; if (!*s) - return FTPINVPASV; + { + xfree (respline); + return FTPINVPASV; + } /* First, get the address family */ af = 0; @@ -756,9 +761,6 @@ ftp_epsv (int csock, ip_address *ip, int *port) DEBUGP(("respline is %s\n", respline)); - /* Parse the response. */ - s = respline; - /* Skip the useless stuff and get what's inside the parentheses */ start = strchr (respline, '('); if (start == NULL) @@ -804,7 +806,7 @@ ftp_epsv (int csock, ip_address *ip, int *port) return FTPINVPASV; } - if (*s++ != ')') + if (*s != ')') { xfree (respline); return FTPINVPASV;