X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fdelete_image.c;h=7e33ea3cebbcf59dcc6435ca242f1513583b0541;hb=61e88c80f4b0262be1da706d2dbb05597b265cd1;hp=131ec8d94f83525b2e3833406dea69ca94f54db4;hpb=3071e89c11d1be71cf45b694432e5908e0c4ded9;p=wimlib diff --git a/src/delete_image.c b/src/delete_image.c index 131ec8d9..7e33ea3c 100644 --- a/src/delete_image.c +++ b/src/delete_image.c @@ -37,10 +37,6 @@ wimlib_delete_image(WIMStruct *wim, int image) int ret; int first, last; - ret = can_delete_from_wim(wim); - if (ret) - return ret; - if (image == WIMLIB_ALL_IMAGES) { last = wim->hdr.image_count; first = 1; @@ -52,16 +48,16 @@ wimlib_delete_image(WIMStruct *wim, int image) for (image = last; image >= first; image--) { DEBUG("Deleting image %d", image); - /* Even if the dentry tree is not allocated, we must select it (and - * therefore allocate it) so that we can decrement the reference counts - * in the lookup table. */ + /* Even if the dentry tree is not allocated, we must select it + * (and therefore allocate it) so that we can decrement stream + * reference counts. */ ret = select_wim_image(wim, image); if (ret) return ret; - /* Unless the image metadata is shared by another WIMStruct, free the - * dentry tree, any lookup table entries that have their refcnt - * decremented to 0, and the security data. */ + /* Unless the image metadata is shared by another WIMStruct, + * free the dentry tree, free the security data, and decrement + * stream reference counts. */ put_image_metadata(wim->image_metadata[image - 1], wim->lookup_table); /* Get rid of the empty slot in the image metadata array. */