-#ifdef __WIN32__
- return false;
-#else
- char *ctype = nl_langinfo(CODESET);
-
- return (!strstr(ctype, "UTF-8") ||
- !strstr(ctype, "UTF8") ||
- !strstr(ctype, "utf8") ||
- !strstr(ctype, "utf-8"));
-#endif
+ if (!wim)
+ return;
+
+ /* The blob table and image metadata are freed immediately, but other
+ * members of the WIMStruct such as the input file descriptor are
+ * retained until no more exported resources reference the WIMStruct. */
+
+ free_blob_table(wim->blob_table);
+ wim->blob_table = NULL;
+ if (wim->image_metadata != NULL) {
+ deselect_current_wim_image(wim);
+ for (int i = 0; i < wim->hdr.image_count; i++)
+ put_image_metadata(wim->image_metadata[i]);
+ FREE(wim->image_metadata);
+ wim->image_metadata = NULL;
+ }
+
+ wim_decrement_refcnt(wim);