From 664c8ef75b4ab6643b1222d6626b2f8760a786a1 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Fri, 15 Nov 2013 23:06:31 +0530 Subject: [PATCH] Fix fd leak. --- archive/pc_archive.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archive/pc_archive.c b/archive/pc_archive.c index ff1f13d..9a3d013 100644 --- a/archive/pc_archive.c +++ b/archive/pc_archive.c @@ -878,10 +878,13 @@ copy_file_data(pc_ctx_t *pctx, struct archive *arc, struct archive_entry *entry, int64_t rv; rv = process_by_filter(fd, typ, arc, NULL, entry, 1); - if (rv == FILTER_RETURN_ERROR) + if (rv == FILTER_RETURN_ERROR) { + close(fd); return (-1); - else if (rv != FILTER_RETURN_SKIP) + } else if (rv != FILTER_RETURN_SKIP) { + close(fd); return (ARCHIVE_OK); + } } }