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:
Ján Tomko
2021-08-11 13:50:23 +02:00
parent be72434d79
commit 2a7e5240ff
2 changed files with 4 additions and 8 deletions

View File

@@ -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;
}