]> wimlib.net Git - wimlib/blobdiff - src/add_image.c
A few cleanups and fixes from recent changes
[wimlib] / src / add_image.c
index e01f80a8095e1bfc18787158358d2aec28d056bd..86ba9f0b3d277ede7bb588ba2baf57e754783907 100644 (file)
@@ -88,10 +88,6 @@ wimlib_add_empty_image(WIMStruct *wim, const tchar *name, int *new_idx_ret)
 {
        int ret;
 
-       ret = can_modify_wim(wim);
-       if (ret)
-               return ret;
-
        if (!name)
                name = T("");
 
@@ -195,14 +191,8 @@ wimlib_add_image_multisource(WIMStruct *wim,
        return 0;
 
 out_delete_image:
-       /* Unsuccessful; rollback the WIM to its original state.  */
-
-       /* wimlib_update_image() is now all-or-nothing, so no dentries remain
-        * and there's no need to pass the lookup table here.  */
-       put_image_metadata(wim->image_metadata[wim->hdr.image_count - 1], NULL);
-
-       xml_delete_image(&wim->wim_info, wim->hdr.image_count);
-       wim->hdr.image_count--;
+       /* Unsuccessful; rollback by removing the new image.  */
+       delete_wim_image(wim, wim->hdr.image_count);
        return ret;
 }