]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Use VIR_STEAL_PTR in virstoragefile
authorJohn Ferlan <jferlan@redhat.com>
Thu, 7 Feb 2019 13:07:50 +0000 (08:07 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 13:51:23 +0000 (08:51 -0500)
Rather than open coding virStorageFileGetRelativeBackingPath
and virStorageFileGetMetadataRecurse, let's make use of the
VIR_STEAL_PTR macro.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virstoragefile.c

index 828e95d5d37949bed9e471186b64068b9de20433..c6425308fb5efcae4fe64c2216ee284c9afe80cb 100644 (file)
@@ -4208,8 +4208,7 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
         goto cleanup;
     }
 
-    *relpath = path;
-    path = NULL;
+    VIR_STEAL_PTR(*relpath, path);
 
     ret = 0;
 
@@ -4947,8 +4946,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
             goto cleanup;
     }
 
-    src->backingStore = backingStore;
-    backingStore = NULL;
+    VIR_STEAL_PTR(src->backingStore, backingStore);
     ret = 0;
 
  cleanup: