render / rpms / libvirt

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