X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fadd_image.c;h=86ba9f0b3d277ede7bb588ba2baf57e754783907;hb=0f4054ebfa380de7c85edfabf215599a8ff63143;hp=e01f80a8095e1bfc18787158358d2aec28d056bd;hpb=3071e89c11d1be71cf45b694432e5908e0c4ded9;p=wimlib diff --git a/src/add_image.c b/src/add_image.c index e01f80a8..86ba9f0b 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -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; }