From 9ecb0e44060646534969586cf2b3a7c4dcd6118d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 27 Mar 2022 16:33:02 -0300 Subject: [PATCH] Virtual ISO: Fix closing of file handles when unloading image --- src/cdrom/cdrom_image_viso.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cdrom/cdrom_image_viso.c b/src/cdrom/cdrom_image_viso.c index 123a213a2..8be878843 100644 --- a/src/cdrom/cdrom_image_viso.c +++ b/src/cdrom/cdrom_image_viso.c @@ -1115,6 +1115,9 @@ next_dir: viso_pwrite(data, dir->pt_offsets[i << 1] + 2, 4, 1, viso->tf.file); /* little endian */ viso_pwrite(data + 4, dir->pt_offsets[(i << 1) | 1] + 2, 4, 1, viso->tf.file); /* big endian */ + if (i) /* clear union if we no longer need path table offsets */ + dir->file = NULL; + /* Go through entries in this directory. */ viso_entry_t *entry = dir->first_child; int dir_type = (dir == &viso->root_dir) ? VISO_DIR_CURRENT_ROOT : VISO_DIR_CURRENT; @@ -1246,7 +1249,8 @@ next_entry: *entry_map_p++ = entry; /* Move on to the next entry. */ - entry = entry->next; + prev_entry = entry; + entry = entry->next; } /* Write final volume size to all volume descriptors. */