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

[libvirt] [PATCH v3 06/13] vbox: Do not free disk definitions on cleanup



Both vboxSnapshotGetReadWriteDisks and vboxSnapshotGetReadWriteDisks do
not need to free the def->disks on cleanup because it's being done by
the caller via virDomainSnaphotDefFree
---
 src/vbox/vbox_common.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index d26ce1bce..79030e36e 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -5883,13 +5883,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDefPtr def,
     ret = 0;
 
  cleanup:
-    if (ret < 0) {
-        for (i = 0; i < def->ndisks; i++)
-            VIR_FREE(def->disks[i].src);
-        VIR_FREE(def->disks);
-        def->ndisks = 0;
-    }
     VBOX_RELEASE(snap);
+
     return ret;
 }
 
@@ -6105,16 +6100,11 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotPtr snapshot,
     ret = 0;
 
  cleanup:
-    if (ret < 0) {
-        for (i = 0; i < def->dom->ndisks; i++)
-            virDomainDiskDefFree(def->dom->disks[i]);
-        VIR_FREE(def->dom->disks);
-        def->dom->ndisks = 0;
-    }
     VBOX_RELEASE(disk);
     VBOX_RELEASE(storageController);
     gVBoxAPI.UArray.vboxArrayRelease(&mediumAttachments);
     VBOX_RELEASE(snap);
+
     return ret;
 }
 
-- 
2.14.3


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