Fix fd leak.

This commit is contained in:
Moinak Ghosh 2013-11-15 23:06:31 +05:30
parent c09a2b7b81
commit 664c8ef75b

View file

@ -878,12 +878,15 @@ copy_file_data(pc_ctx_t *pctx, struct archive *arc, struct archive_entry *entry,
int64_t rv; int64_t rv;
rv = process_by_filter(fd, typ, arc, NULL, entry, 1); rv = process_by_filter(fd, typ, arc, NULL, entry, 1);
if (rv == FILTER_RETURN_ERROR) if (rv == FILTER_RETURN_ERROR) {
close(fd);
return (-1); return (-1);
else if (rv != FILTER_RETURN_SKIP) } else if (rv != FILTER_RETURN_SKIP) {
close(fd);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
} }
}
/* /*
* Use mmap for copying file data. Not necessarily for performance, but it saves on * Use mmap for copying file data. Not necessarily for performance, but it saves on