mirror of https://gitee.com/openkylin/libvirt.git
qemuProcessRefreshDisks: Automatically free GHashTable and refactor cleanup
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
7ef8e9af6f
commit
2e93441697
|
@ -8310,8 +8310,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver,
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||||
GHashTable *table = NULL;
|
g_autoptr(GHashTable) table = NULL;
|
||||||
int ret = -1;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
|
||||||
|
@ -8320,7 +8319,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!table)
|
if (!table)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < vm->def->ndisks; i++) {
|
for (i = 0; i < vm->def->ndisks; i++) {
|
||||||
virDomainDiskDef *disk = vm->def->disks[i];
|
virDomainDiskDef *disk = vm->def->disks[i];
|
||||||
|
@ -8351,11 +8350,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver,
|
||||||
diskpriv->tray = info->tray;
|
diskpriv->tray = info->tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virHashFree(table);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue