The comment and the caller assume virQEMUSaveDataNew only steals
domXML on success, but it is copied even on failure.

Also remove the misleading g_steal_pointer call on a local variable.

Reported by coverity.

Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 src/qemu/qemu_saveimage.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index de2d63dd9a..5d542bf977 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -105,8 +105,6 @@ virQEMUSaveDataNew(char *domXML,
 
     data = g_new0(virQEMUSaveData, 1);
 
-    data->xml = g_steal_pointer(&domXML);
-
     if (cookieObj &&
         !(data->cookie = virSaveCookieFormat((virObjectPtr) cookieObj,
                                              
virDomainXMLOptionGetSaveCookie(xmlopt))))
@@ -118,6 +116,7 @@ virQEMUSaveDataNew(char *domXML,
     header->was_running = running ? 1 : 0;
     header->compressed = compressed;
 
+    data->xml = domXML;
     return data;
 
  error:
-- 
2.26.2

Reply via email to