render / rpms / libvirt

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