Use g_new0 to completely avoid the 'cleanup' labe.
Signed-off-by: Peter Krempa <pkrempa(a)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 152c73f1bf..0357815b07 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.24.1