[libvirt PATCH 2/4] qemu: saveimage: only steal domXML on success

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <jtomko@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux