render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d76c62
From f6f1f6ccc4ade458c159e45d51d627bcde61b303 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <f6f1f6ccc4ade458c159e45d51d627bcde61b303@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Mon, 16 Mar 2020 22:11:40 +0100
d76c62
Subject: [PATCH] qemuBlockStorageSourceDetachPrepare: Get rid of cleanup
d76c62
 section
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Use g_new0 to completely avoid the 'cleanup' label.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 4415b11d6b68643b93014d0e505cb23c5ce63bf0)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
d76c62
Message-Id: <378b5200c9dbf740d695333b367b4a2d24746049.1584391726.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_block.c | 10 ++--------
d76c62
 1 file changed, 2 insertions(+), 8 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
d76c62
index 5bd5c955a4..5144cf266f 100644
d76c62
--- a/src/qemu/qemu_block.c
d76c62
+++ b/src/qemu/qemu_block.c
d76c62
@@ -1734,10 +1734,8 @@ qemuBlockStorageSourceDetachPrepare(virStorageSourcePtr src,
d76c62
 {
d76c62
     qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
d76c62
     g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
d76c62
-    qemuBlockStorageSourceAttachDataPtr ret = NULL;
d76c62
 
d76c62
-    if (VIR_ALLOC(data) < 0)
d76c62
-        goto cleanup;
d76c62
+    data = g_new0(qemuBlockStorageSourceAttachData, 1);
d76c62
 
d76c62
     if (driveAlias) {
d76c62
         data->driveAlias = g_steal_pointer(&driveAlias);
d76c62
@@ -1771,11 +1769,7 @@ qemuBlockStorageSourceDetachPrepare(virStorageSourcePtr src,
d76c62
             data->encryptsecretAlias = g_strdup(srcpriv->encinfo->s.aes.alias);
d76c62
     }
d76c62
 
d76c62
-    ret = g_steal_pointer(&data);
d76c62
-
d76c62
- cleanup:
d76c62
-    VIR_FREE(driveAlias);
d76c62
-    return ret;
d76c62
+    return g_steal_pointer(&data);
d76c62
 }
d76c62
 
d76c62
 
d76c62
-- 
d76c62
2.25.1
d76c62