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