mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemuMigrationParamsNew: Use new memory allocation to simplify code
Use automatic memory cleaning and allocate via g_new0. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9586367d7e
commit
da1831de96
@ -244,20 +244,14 @@ qemuMigrationParamsGetAlwaysOnCaps(qemuMigrationParty party)
|
||||
qemuMigrationParamsPtr
|
||||
qemuMigrationParamsNew(void)
|
||||
{
|
||||
qemuMigrationParamsPtr params;
|
||||
g_autoptr(qemuMigrationParams) params = NULL;
|
||||
|
||||
if (VIR_ALLOC(params) < 0)
|
||||
params = g_new0(qemuMigrationParams, 1);
|
||||
|
||||
if (!(params->caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
||||
return NULL;
|
||||
|
||||
params->caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
if (!params->caps)
|
||||
goto error;
|
||||
|
||||
return params;
|
||||
|
||||
error:
|
||||
qemuMigrationParamsFree(params);
|
||||
return NULL;
|
||||
return g_steal_pointer(¶ms);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user