mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu_driver.c: use g_autoptr() with virDomainDeviceDefPtr
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
94196ba605
commit
9c215628d6
@ -7761,9 +7761,9 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
|
|||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
g_autoptr(virDomainDef) vmdef = NULL;
|
g_autoptr(virDomainDef) vmdef = NULL;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||||
virDomainDeviceDefPtr devConf = NULL;
|
g_autoptr(virDomainDeviceDef) devConf = NULL;
|
||||||
virDomainDeviceDef devConfSave = { 0 };
|
virDomainDeviceDef devConfSave = { 0 };
|
||||||
virDomainDeviceDefPtr devLive = NULL;
|
g_autoptr(virDomainDeviceDef) devLive = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
|
||||||
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
|
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
|
||||||
@ -7849,9 +7849,6 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainDeviceDefFree(devConf);
|
|
||||||
virDomainDeviceDefFree(devLive);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7907,7 +7904,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
|||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
g_autoptr(virDomainDef) vmdef = NULL;
|
g_autoptr(virDomainDef) vmdef = NULL;
|
||||||
virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
|
g_autoptr(virDomainDeviceDef) dev = NULL;
|
||||||
|
virDomainDeviceDefPtr dev_copy = NULL;
|
||||||
bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
|
bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||||
@ -8003,7 +8001,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (dev != dev_copy)
|
if (dev != dev_copy)
|
||||||
virDomainDeviceDefFree(dev_copy);
|
virDomainDeviceDefFree(dev_copy);
|
||||||
virDomainDeviceDefFree(dev);
|
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virNWFilterUnlockFilterUpdates();
|
virNWFilterUnlockFilterUpdates();
|
||||||
return ret;
|
return ret;
|
||||||
@ -8017,7 +8014,8 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
|
|||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||||
virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
|
g_autoptr(virDomainDeviceDef) dev = NULL;
|
||||||
|
virDomainDeviceDefPtr dev_copy = NULL;
|
||||||
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
|
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
|
||||||
g_autoptr(virDomainDef) vmdef = NULL;
|
g_autoptr(virDomainDef) vmdef = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -8093,7 +8091,6 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (dev != dev_copy)
|
if (dev != dev_copy)
|
||||||
virDomainDeviceDefFree(dev_copy);
|
virDomainDeviceDefFree(dev_copy);
|
||||||
virDomainDeviceDefFree(dev);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user