[PATCH 1/2] conf: Add cleanup label to virDomainDefParse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7f49c8253f..17ddebb575 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21517,16 +21517,18 @@ virDomainDefParse(const char *xmlStr,
                   void *parseOpaque,
                   unsigned int flags)
 {
-    xmlDocPtr xml;
+    xmlDocPtr xml = NULL;
     virDomainDefPtr def = NULL;
     int keepBlanksDefault = xmlKeepBlanksDefault(0);
 
-    if ((xml = virXMLParse(filename, xmlStr, _("(domain_definition)")))) {
-        def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
-                                    xmlopt, parseOpaque, flags);
-        xmlFreeDoc(xml);
-    }
+    if (!(xml = virXMLParse(filename, xmlStr, _("(domain_definition)"))))
+        goto cleanup;
 
+    def = virDomainDefParseNode(xml, xmlDocGetRootElement(xml), caps,
+                                xmlopt, parseOpaque, flags);
+
+ cleanup:
+    xmlFreeDoc(xml);
     xmlKeepBlanksDefault(keepBlanksDefault);
     return def;
 }
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux