summaryrefslogtreecommitdiffstats
path: root/src/fetch.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-26 14:12:02 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-26 14:23:12 +0000
commitc8c985136950eee7f6748593d6fdf31eea7f8493 (patch)
tree3b06861f3c6847b7615c37b14fbe3fe6b6ad61ee /src/fetch.c
parentfed1474d5adc1117d95b5c68e8ad63f9dfebeb79 (diff)
downloadapk-tools-c8c985136950eee7f6748593d6fdf31eea7f8493.tar.bz2
apk-tools-c8c985136950eee7f6748593d6fdf31eea7f8493.tar.xz
fetch: fix fd leak
we should always close the in-stream, not only on failure.
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 9e0d930..f3c651b 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -95,10 +95,10 @@ static int fetch_package(struct fetch_ctx *fctx,
}
r = apk_istream_splice(is, fd, pkg->size, NULL, NULL);
+ is->close(is);
if (fd != STDOUT_FILENO)
close(fd);
if (r != pkg->size) {
- is->close(is);
apk_error("Unable to download '%s'", file);
unlink(file);
return -1;