]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
Comments etc.
[wimlib] / src / lookup_table.c
index 007cd9eae689d655ec4580b7d2a00bfcf9fb84f2..e8f44eac70355b6a0efdc895b15dd71111813469 100644 (file)
@@ -73,11 +73,31 @@ struct lookup_table_entry *new_lookup_table_entry()
 void free_lookup_table_entry(struct lookup_table_entry *lte)
 {
        if (lte) {
+#ifdef WITH_FUSE
                if (lte->staging_list.next)
                        list_del(&lte->staging_list);
-               if (lte->resource_location != RESOURCE_IN_WIM &&
-                   lte->resource_location != RESOURCE_NONEXISTENT)
+#endif
+               switch (lte->resource_location) {
+               case RESOURCE_IN_STAGING_FILE:
+               case RESOURCE_IN_ATTACHED_BUFFER:
+               case RESOURCE_IN_FILE_ON_DISK:
+                       wimlib_assert(&lte->file_on_disk ==
+                                     &lte->staging_file_name ==
+                                     &lte->attached_buffer);
                        FREE(lte->file_on_disk);
+                       break;
+#ifdef WITH_NTFS_3G
+               case RESOURCE_IN_NTFS_VOLUME:
+                       if (lte->ntfs_loc) {
+                               FREE(lte->ntfs_loc->path_utf8);
+                               FREE(lte->ntfs_loc->stream_name_utf16);
+                               FREE(lte->ntfs_loc);
+                       }
+                       break;
+#endif
+               default:
+                       break;
+               }
                FREE(lte);
        }
 }
@@ -133,7 +153,10 @@ lte_decrement_refcnt(struct lookup_table_entry *lte, struct lookup_table *table)
                wimlib_assert(lte->refcnt);
                if (--lte->refcnt == 0) {
                        lookup_table_unlink(table, lte);
-                       if (lte->num_opened_fds == 0) {
+               #ifdef WITH_FUSE
+                       if (lte->num_opened_fds == 0)
+               #endif
+                       {
                                free_lookup_table_entry(lte);
                                lte = NULL;
                        }