]> wimlib.net Git - wimlib/blobdiff - src/xml.c
add image cleanups
[wimlib] / src / xml.c
index 4a09103ce4ccb36e9cc2ef30cf64cb8e6aa2a98c..440398954a3d4e53b9c48a2bd8f8238a0c710052 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -982,7 +982,7 @@ static int calculate_dentry_statistics(struct dentry *dentry, void *arg)
        /* Update directory count and file count.
         *
         * Each dentry counts as either a file or a directory, but not both.
        /* Update directory count and file count.
         *
         * Each dentry counts as either a file or a directory, but not both.
-        * The root directory is an exception: it is not counted.
+        * The root directory is an exception: it is not counted at all.
         *
         * Symbolic links and junction points (and presumably other reparse
         * points) count as regular files.  This is despite the fact that
         *
         * Symbolic links and junction points (and presumably other reparse
         * points) count as regular files.  This is despite the fact that
@@ -1109,10 +1109,9 @@ int xml_add_image(WIMStruct *w, const char *name)
 
 out_destroy_image_info:
        destroy_image_info(image_info);
 
 out_destroy_image_info:
        destroy_image_info(image_info);
+       wim_info->num_images--;
 out_free_wim_info:
 out_free_wim_info:
-       if (w->wim_info)
-               wim_info->num_images--;
-       else
+       if (wim_info != w->wim_info)
                FREE(wim_info);
        ERROR("Out of memory");
        return WIMLIB_ERR_NOMEM;
                FREE(wim_info);
        ERROR("Out of memory");
        return WIMLIB_ERR_NOMEM;