]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
Comments etc.
[wimlib] / src / lookup_table.c
index 92fb8a9f178b0713bea0b6000e2fbc18b781edd6..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;
                        }
@@ -344,6 +367,8 @@ void print_lookup_table_entry(const struct lookup_table_entry *lte)
        case RESOURCE_IN_STAGING_FILE:
                printf("Staging File      = `%s'\n", lte->staging_file_name);
                break;
+       default:
+               break;
        }
        putchar('\n');
 }
@@ -397,7 +422,7 @@ int lookup_resource(WIMStruct *w, const char *path,
        struct dentry *dentry;
        struct lookup_table_entry *lte;
        unsigned stream_idx;
-       const char *stream_name;
+       const char *stream_name = NULL;
        char *p = NULL;
 
        if (lookup_flags & LOOKUP_FLAG_ADS_OK) {