mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemuMigrationCookieAddNBD: Use virHashNew and automatic freeing of virHashTablePtr
Swithc to the helper which doesn't require checking of the return value. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
464345e153
commit
45eefb2c78
@ -454,7 +454,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virHashTablePtr stats = NULL;
|
||||
g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
|
||||
size_t i;
|
||||
int ret = -1, rc;
|
||||
|
||||
@ -472,9 +472,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
mig->nbd->disks = g_new0(struct qemuMigrationCookieNBDDisk, vm->def->ndisks);
|
||||
mig->nbd->ndisks = 0;
|
||||
|
||||
if (!(stats = virHashCreate(10, virHashValueFree)))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, priv->job.asyncJob) < 0)
|
||||
goto cleanup;
|
||||
rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false);
|
||||
@ -496,7 +493,6 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virHashFree(stats);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user