]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainSnapshotDefParse: Prefer VIR_STEAL_PTR
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 21 Jun 2018 10:11:29 +0000 (12:11 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Jun 2018 05:19:53 +0000 (07:19 +0200)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/conf/snapshot_conf.c

index 787c3d0feb5452a97db16d4e99fcfde032a73664..9c537ac7d14be53deb117168740b88dbbad1a0e5 100644 (file)
@@ -331,8 +331,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
                          "disk-only snapshot"));
         goto cleanup;
     }
-    def->file = memoryFile;
-    memoryFile = NULL;
+    VIR_STEAL_PTR(def->file, memoryFile);
 
     /* verify that memory path is absolute */
     if (def->file && def->file[0] != '/') {
@@ -372,7 +371,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
     if (!offline && virSaveCookieParse(ctxt, &def->cookie, saveCookie) < 0)
         goto cleanup;
 
-    ret = def;
+    VIR_STEAL_PTR(ret, def);
 
  cleanup:
     VIR_FREE(creation);
@@ -380,8 +379,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
     VIR_FREE(nodes);
     VIR_FREE(memorySnapshot);
     VIR_FREE(memoryFile);
-    if (ret == NULL)
-        virDomainSnapshotDefFree(def);
+    virDomainSnapshotDefFree(def);
 
     return ret;
 }