Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 tools/virsh-domain.c | 9 +++------
 tools/virsh-volume.c | 3 +--
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 398190bb5b..0c60a4de99 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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;
 }
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index c9c4310cbd..4b179d7d87 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -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;
 }
-- 
2.31.1

Reply via email to