- /* Get rid of the empty slot in the image metadata array. */
- memmove(&w->image_metadata[image - 1], &w->image_metadata[image],
- (w->hdr.image_count - image) * sizeof(struct wim_image_metadata));
+ /* Unless the image metadata is shared by another WIMStruct, free the
+ * dentry tree, any lookup table entries that have their refcnt
+ * decremented to 0, and the security data. */
+ put_image_metadata(w->image_metadata[image - 1], w->lookup_table);