1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-02-10 17:57:25 +03:00

qemuBlockStorageSourceDetachPrepare: Get rid of cleanup section

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>
This commit is contained in:
Peter Krempa 2020-03-06 09:45:45 +01:00
parent 4653a5194c
commit 4415b11d6b

View File

@ -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);
}