]> wimlib.net Git - wimlib/blobdiff - src/xml.c
xml_export_image(): fix memory leak if append_image_node() fails
[wimlib] / src / xml.c
index a6dab415e891fdf996769bc0ec26f7e6e48207bb..baf51941eaa1308337a436dc1c0321da698e4246 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -809,7 +809,10 @@ xml_export_image(const struct wim_xml_info *src_info, int src_image,
 
        xmlFreeProp(unlink_index_attribute(dest_node));
 
-       return append_image_node(dest_info, dest_node);
+       ret = append_image_node(dest_info, dest_node);
+       if (ret)
+               goto err;
+       return 0;
 
 err:
        xmlFreeNode(dest_node);