aboutsummaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_mtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_read_support_format_mtree.c')
-rw-r--r--libarchive/archive_read_support_format_mtree.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c
index 10c07b05d965..4a5a49ca8136 100644
--- a/libarchive/archive_read_support_format_mtree.c
+++ b/libarchive/archive_read_support_format_mtree.c
@@ -300,7 +300,12 @@ cleanup(struct archive_read *a)
struct mtree_entry *p, *q;
mtree = (struct mtree *)(a->format->data);
-
+
+ /* Close any dangling file descriptor before freeing */
+ if (mtree->fd >= 0) {
+ close(mtree->fd);
+ mtree->fd = -1;
+ }
p = mtree->entries;
while (p != NULL) {
q = p->next;