]> wimlib.net Git - wimlib/blobdiff - src/wim.c
Fixes; comments
[wimlib] / src / wim.c
index 96fba59f284ac98c553b59291c69d5829b290eab..4060fa581d4cbf0ebf0146af7f3cd67b5f5667cd 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -199,6 +199,7 @@ select_wim_image(WIMStruct *w, int image)
        if (w->current_image != WIMLIB_NO_IMAGE) {
                imd = wim_get_current_image_metadata(w);
                if (!imd->modified) {
+                       wimlib_assert(list_empty(&imd->unhashed_streams));
                        DEBUG("Freeing image %u", w->current_image);
                        destroy_image_metadata(imd, NULL, false);
                }
@@ -532,6 +533,11 @@ destroy_image_metadata(struct wim_image_metadata *imd,
                free_lookup_table_entry(imd->metadata_lte);
                imd->metadata_lte = NULL;
        }
+       if (!table) {
+               struct wim_lookup_table_entry *lte, *tmp;
+               list_for_each_entry_safe(lte, tmp, &imd->unhashed_streams, unhashed_list)
+                       free_lookup_table_entry(lte);
+       }
        INIT_LIST_HEAD(&imd->unhashed_streams);
        INIT_LIST_HEAD(&imd->inode_list);
 }