- wimlib_assert(lte->refcnt == inode->i_nlink);
-
- /* If the WIM of the template image is the same as the WIM of
- * the new image, then @template_lte can be used directly.
- *
- * Otherwise, look for a stream with the same hash in the WIM of
- * the new image. If found, use it; otherwise re-use the entry
- * being discarded, filling in the hash. */
-
- if (wim == template_wim)
- replace_lte = template_lte;
- else
- replace_lte = lookup_stream(wim->lookup_table,
- template_lte->hash);
-
- list_del(<e->unhashed_list);
- if (replace_lte) {
- free_lookup_table_entry(lte);
- } else {
- copy_hash(lte->hash, template_lte->hash);
- lte->unhashed = 0;
- lookup_table_insert(wim->lookup_table, lte);
- lte->refcnt = 0;
- replace_lte = lte;
- }
-
- if (i == 0)
- inode->i_lte = replace_lte;
- else
- inode->i_ads_entries[i - 1].lte = replace_lte;
-
- replace_lte->refcnt += inode->i_nlink;
+ back_ptr = retrieve_pointer_to_unhashed_blob(blob);
+ copy_hash(blob->hash, template_blob->hash);
+ if (after_blob_hashed(blob, back_ptr, blob_table) != blob)
+ free_blob_descriptor(blob);