mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +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;
|
||||
xmlDocPtr xml = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
g_autoptr(xmlXPathObject) obj = NULL;
|
||||
xmlNodePtr cur = NULL;
|
||||
char *xml_buf = NULL;
|
||||
|
||||
@ -3178,7 +3178,6 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
cleanup:
|
||||
xmlXPathFreeObject(obj);
|
||||
xmlFreeDoc(xml);
|
||||
VIR_FREE(xml_buf);
|
||||
|
||||
@ -12070,7 +12069,7 @@ virshDomainDetachInterface(char *doc,
|
||||
const char *mac)
|
||||
{
|
||||
xmlDocPtr xml = NULL;
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
g_autoptr(xmlXPathObject) obj = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
xmlNodePtr cur = NULL, matchNode = NULL;
|
||||
char *detach_xml = NULL;
|
||||
@ -12145,7 +12144,6 @@ virshDomainDetachInterface(char *doc,
|
||||
cleanup:
|
||||
VIR_FREE(detach_xml);
|
||||
xmlFreeDoc(xml);
|
||||
xmlXPathFreeObject(obj);
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
@ -12250,7 +12248,7 @@ virshFindDisk(const char *doc,
|
||||
int type)
|
||||
{
|
||||
xmlDocPtr xml = NULL;
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
g_autoptr(xmlXPathObject) obj = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
xmlNodePtr cur = 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);
|
||||
|
||||
cleanup:
|
||||
xmlXPathFreeObject(obj);
|
||||
xmlFreeDoc(xml);
|
||||
return ret;
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ virshMakeCloneXML(const char *origxml, const char *newname)
|
||||
{
|
||||
xmlDocPtr doc = NULL;
|
||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
g_autoptr(xmlXPathObject) obj = NULL;
|
||||
xmlChar *newxml = NULL;
|
||||
int size;
|
||||
|
||||
@ -544,7 +544,6 @@ virshMakeCloneXML(const char *origxml, const char *newname)
|
||||
xmlDocDumpMemory(doc, &newxml, &size);
|
||||
|
||||
cleanup:
|
||||
xmlXPathFreeObject(obj);
|
||||
xmlFreeDoc(doc);
|
||||
return newxml;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user