diff options
author | joerg <joerg@pkgsrc.org> | 2010-08-20 17:56:49 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2010-08-20 17:56:49 +0000 |
commit | e73dcf0c756c643b4b128676e42141921e5e3a68 (patch) | |
tree | f65e2ab861df77805ec160c7e3b6b718cd8d216f | |
parent | 1703449698cacf21e681c6694e8b3f71acbf9990 (diff) | |
download | pkgsrc-e73dcf0c756c643b4b128676e42141921e5e3a68.tar.gz |
libfetch-2.33:
Don't leak FTP connections on errors in fetch or if only stat is
requested. Reported via Xavier Chantry.
-rw-r--r-- | net/libfetch/Makefile | 4 | ||||
-rw-r--r-- | net/libfetch/files/ftp.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/net/libfetch/Makefile b/net/libfetch/Makefile index daadd8c9fad..4f2c04e7297 100644 --- a/net/libfetch/Makefile +++ b/net/libfetch/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.39 2010/06/13 21:38:08 joerg Exp $ +# $NetBSD: Makefile,v 1.40 2010/08/20 17:56:49 joerg Exp $ # -DISTNAME= libfetch-2.32 +DISTNAME= libfetch-2.33 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty diff --git a/net/libfetch/files/ftp.c b/net/libfetch/files/ftp.c index 9ef5ac939d4..cd6bee13f40 100644 --- a/net/libfetch/files/ftp.c +++ b/net/libfetch/files/ftp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftp.c,v 1.35 2010/03/21 16:48:43 joerg Exp $ */ +/* $NetBSD: ftp.c,v 1.36 2010/08/20 17:56:49 joerg Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav * Copyright (c) 2008, 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org> @@ -1155,12 +1155,14 @@ ftp_request(struct url *url, const char *op, const char *op_arg, return (NULL); if ((path = fetchUnquotePath(url)) == NULL) { + fetch_close(conn); fetch_syserr(); return NULL; } /* change directory */ if (ftp_cwd(conn, path, op_arg != NULL) == -1) { + fetch_close(conn); free(path); return (NULL); } @@ -1173,12 +1175,14 @@ ftp_request(struct url *url, const char *op, const char *op_arg, if (us && ftp_stat(conn, path, us) == -1 && fetchLastErrCode != FETCH_PROTO && fetchLastErrCode != FETCH_UNAVAIL) { + fetch_close(conn); free(path); return (NULL); } if (if_modified_since && url->last_modified > 0 && url->last_modified >= us->mtime) { + fetch_cache_put(conn, ftp_disconnect); free(path); fetchLastErrCode = FETCH_UNCHANGED; snprintf(fetchLastErrString, MAXERRSTRING, "Unchanged"); @@ -1187,6 +1191,7 @@ ftp_request(struct url *url, const char *op, const char *op_arg, /* just a stat */ if (strcmp(op, "STAT") == 0) { + fetch_cache_put(conn, ftp_disconnect); free(path); return fetchIO_unopen(NULL, NULL, NULL, NULL); } |