tools: virsh: use automatic cleanup for xmlXPathContext

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Ján Tomko committed 2021-08-16 13:10:33 +02:00
1 parent cf337df3d6
commit be72434d79
6 files changed
+23 -46

No files matched your search

+2 -4
View File
@@ -822,7 +822,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
xmlChar *br_xml = NULL;
int br_xml_size;
xmlDocPtr xml_doc = NULL;
xmlXPathContextPtr ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr top_node, br_node, if_node, cur;
virshControl *priv = ctl->privData;
@@ -1001,7 +1001,6 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(if_type);
VIR_FREE(if2_name);
VIR_FREE(delay_str);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(xml_doc);
return ret;
}
@@ -1044,7 +1043,7 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
xmlChar *if_xml = NULL;
int if_xml_size;
xmlDocPtr xml_doc = NULL;
xmlXPathContextPtr ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr top_node, if_node, cur;
virshControl *priv = ctl->privData;
@@ -1201,7 +1200,6 @@ cmdInterfaceUnbridge(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(br_xml);
VIR_FREE(if_type);
VIR_FREE(if_name);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(xml_doc);
return ret;
}