mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
tools: virsh: use automatic cleanup for xmlXPathObject
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
be72434d79
commit
2a7e5240ff
@ -3066,7 +3066,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
|
|||||||
size_t i;
|
size_t i;
|
||||||
xmlDocPtr xml = NULL;
|
xmlDocPtr xml = NULL;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
xmlXPathObjectPtr obj = NULL;
|
g_autoptr(xmlXPathObject) obj = NULL;
|
||||||
xmlNodePtr cur = NULL;
|
xmlNodePtr cur = NULL;
|
||||||
char *xml_buf = NULL;
|
char *xml_buf = NULL;
|
||||||
|
|
||||||
@ -3178,7 +3178,6 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
xmlXPathFreeObject(obj);
|
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
VIR_FREE(xml_buf);
|
VIR_FREE(xml_buf);
|
||||||
|
|
||||||
@ -12070,7 +12069,7 @@ virshDomainDetachInterface(char *doc,
|
|||||||
const char *mac)
|
const char *mac)
|
||||||
{
|
{
|
||||||
xmlDocPtr xml = NULL;
|
xmlDocPtr xml = NULL;
|
||||||
xmlXPathObjectPtr obj = NULL;
|
g_autoptr(xmlXPathObject) obj = NULL;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
xmlNodePtr cur = NULL, matchNode = NULL;
|
xmlNodePtr cur = NULL, matchNode = NULL;
|
||||||
char *detach_xml = NULL;
|
char *detach_xml = NULL;
|
||||||
@ -12145,7 +12144,6 @@ virshDomainDetachInterface(char *doc,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(detach_xml);
|
VIR_FREE(detach_xml);
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
xmlXPathFreeObject(obj);
|
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12250,7 +12248,7 @@ virshFindDisk(const char *doc,
|
|||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
xmlDocPtr xml = NULL;
|
xmlDocPtr xml = NULL;
|
||||||
xmlXPathObjectPtr obj = NULL;
|
g_autoptr(xmlXPathObject) obj = NULL;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
xmlNodePtr cur = NULL;
|
xmlNodePtr cur = NULL;
|
||||||
xmlNodePtr ret = NULL;
|
xmlNodePtr ret = NULL;
|
||||||
@ -12325,7 +12323,6 @@ virshFindDisk(const char *doc,
|
|||||||
vshError(NULL, _("No disk found whose source path or target is %s"), path);
|
vshError(NULL, _("No disk found whose source path or target is %s"), path);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
xmlXPathFreeObject(obj);
|
|
||||||
xmlFreeDoc(xml);
|
xmlFreeDoc(xml);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ virshMakeCloneXML(const char *origxml, const char *newname)
|
|||||||
{
|
{
|
||||||
xmlDocPtr doc = NULL;
|
xmlDocPtr doc = NULL;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
xmlXPathObjectPtr obj = NULL;
|
g_autoptr(xmlXPathObject) obj = NULL;
|
||||||
xmlChar *newxml = NULL;
|
xmlChar *newxml = NULL;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
@ -544,7 +544,6 @@ virshMakeCloneXML(const char *origxml, const char *newname)
|
|||||||
xmlDocDumpMemory(doc, &newxml, &size);
|
xmlDocDumpMemory(doc, &newxml, &size);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
xmlXPathFreeObject(obj);
|
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
return newxml;
|
return newxml;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user