Change all feasible pointers to use g_autoptr().
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_process.c | 113 +++++++++++++---------------------------
1 file changed, 37 insertions(+), 76 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d6d6a9f09b..4870b23704 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -107,7 +107,7 @@ qemuProcessRemoveDomainStatus(virQEMUDriverPtr driver,
char ebuf[1024];
g_autofree char *file = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
file = g_strdup_printf("%s/%s.xml", cfg->stateDir,
vm->def->name);
@@ -120,8 +120,6 @@ qemuProcessRemoveDomainStatus(virQEMUDriverPtr driver,
errno != ENOENT)
VIR_WARN("Failed to remove PID file for %s: %s",
vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));
-
- virObjectUnref(cfg);
}
@@ -401,7 +399,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event;
qemuDomainObjPrivatePtr priv;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
int ret = -1;
virObjectLock(vm);
@@ -438,7 +436,6 @@ qemuProcessHandleReset(qemuMonitorPtr mon G_GNUC_UNUSED,
cleanup:
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return ret;
}
@@ -457,7 +454,7 @@ qemuProcessFakeReboot(void *opaque)
virDomainObjPtr vm = opaque;
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverPtr driver = priv->driver;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainRunningReason reason = VIR_DOMAIN_RUNNING_BOOTED;
int ret = -1, rc;
@@ -507,7 +504,6 @@ qemuProcessFakeReboot(void *opaque)
if (ret == -1)
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
virDomainObjEndAPI(&vm);
- virObjectUnref(cfg);
}
@@ -570,7 +566,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
qemuDomainObjPrivatePtr priv;
virObjectEventPtr event = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
int detail = 0;
VIR_DEBUG("vm=%p", vm);
@@ -627,7 +623,6 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon G_GNUC_UNUSED,
unlock:
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -642,7 +637,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectEventPtr event = NULL;
virDomainPausedReason reason;
virDomainEventSuspendedDetailType detail;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectLock(vm);
@@ -688,7 +683,6 @@ qemuProcessHandleStop(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -701,7 +695,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon G_GNUC_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv;
virDomainRunningReason reason = VIR_DOMAIN_RUNNING_UNPAUSED;
virDomainEventResumedDetailType eventDetail;
@@ -734,7 +728,6 @@ qemuProcessHandleResume(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -746,7 +739,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon G_GNUC_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
@@ -778,7 +771,6 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -792,7 +784,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr watchdogEvent = NULL;
virObjectEventPtr lifecycleEvent = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
watchdogEvent = virDomainEventWatchdogNewFromObj(vm, action);
@@ -840,7 +832,6 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectEventStateQueue(driver->domainEventState, watchdogEvent);
virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
- virObjectUnref(cfg);
return 0;
}
@@ -861,7 +852,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon G_GNUC_UNUSED,
const char *srcPath;
const char *devAlias;
virDomainDiskDefPtr disk;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
@@ -912,7 +903,6 @@ qemuProcessHandleIOError(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectEventStateQueue(driver->domainEventState, ioErrorEvent);
virObjectEventStateQueue(driver->domainEventState, ioErrorEvent2);
virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
- virObjectUnref(cfg);
return 0;
}
@@ -1136,7 +1126,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
virDomainDiskDefPtr disk;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, devAlias, devid);
@@ -1159,7 +1149,6 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -1171,7 +1160,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
virObjectEventPtr lifecycleEvent = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
event = virDomainEventPMWakeupNewFromObj(vm);
@@ -1198,7 +1187,6 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
- virObjectUnref(cfg);
return 0;
}
@@ -1210,7 +1198,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
virObjectEventPtr lifecycleEvent = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
event = virDomainEventPMSuspendNewFromObj(vm);
@@ -1240,7 +1228,6 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectEventStateQueue(driver->domainEventState, event);
virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
- virObjectUnref(cfg);
return 0;
}
@@ -1252,7 +1239,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon G_GNUC_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
event = virDomainEventBalloonChangeNewFromObj(vm, actual);
@@ -1267,7 +1254,6 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -1279,7 +1265,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
virObjectEventPtr lifecycleEvent = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virObjectLock(vm);
event = virDomainEventPMSuspendDiskNewFromObj(vm);
@@ -1309,7 +1295,6 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon G_GNUC_UNUSED,
virObjectEventStateQueue(driver->domainEventState, event);
virObjectEventStateQueue(driver->domainEventState, lifecycleEvent);
- virObjectUnref(cfg);
return 0;
}
@@ -1637,7 +1622,7 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon G_GNUC_UNUSED,
qemuDomainObjPrivatePtr priv;
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
int reason;
virObjectLock(vm);
@@ -1676,7 +1661,6 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon G_GNUC_UNUSED,
cleanup:
virObjectUnlock(vm);
virObjectEventStateQueue(driver->domainEventState, event);
- virObjectUnref(cfg);
return 0;
}
@@ -2722,7 +2706,7 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver,
{
int ret = -1;
size_t i = 0;
- virCapsPtr caps = NULL;
+ g_autoptr(virCaps) caps = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
if (!vm->def->nresctrls)
@@ -2753,7 +2737,6 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(caps);
return ret;
}
@@ -2827,7 +2810,7 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverPtr driver = priv->driver;
- virQEMUDriverConfigPtr cfg;
+ g_autoptr(virQEMUDriverConfig) cfg = NULL;
int errfd = -1;
g_autofree char *pidfile = NULL;
int pidfd = -1;
@@ -2939,7 +2922,6 @@ qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
virCommandFree(cmd);
VIR_FORCE_CLOSE(pidfd);
VIR_FORCE_CLOSE(errfd);
- virObjectUnref(cfg);
return ret;
}
@@ -2950,7 +2932,7 @@ qemuProcessInitPasswords(virQEMUDriverPtr driver,
int asyncJob)
{
int ret = 0;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
size_t i;
for (i = 0; i < vm->def->ngraphics; ++i) {
@@ -2974,7 +2956,6 @@ qemuProcessInitPasswords(virQEMUDriverPtr driver,
}
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -3035,7 +3016,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
ssize_t i;
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainVideoDefPtr video = NULL;
- virQEMUDriverConfigPtr cfg = NULL;
+ g_autoptr(virQEMUDriverConfig) cfg = NULL;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
@@ -3094,7 +3075,6 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver,
cfg = virQEMUDriverGetConfig(driver);
ret = virDomainObjSave(vm, driver->xmlopt, cfg->stateDir);
- virObjectUnref(cfg);
return ret;
@@ -3199,7 +3179,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
/* Bring up netdevs before starting CPUs */
if (qemuInterfaceStartDevices(vm->def) < 0)
@@ -3234,7 +3214,6 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
*/
cleanup:
- virObjectUnref(cfg);
return ret;
release:
@@ -3296,7 +3275,7 @@ static void
qemuProcessNotifyNets(virDomainDefPtr def)
{
size_t i;
- virConnectPtr conn = NULL;
+ g_autoptr(virConnect) conn = NULL;
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
@@ -3314,8 +3293,6 @@ qemuProcessNotifyNets(virDomainDefPtr def)
virDomainNetNotifyActualDevice(conn, def, net);
}
}
-
- virObjectUnref(conn);
}
/* Attempt to instantiate the filters. Ignore failures because it's
@@ -3864,7 +3841,7 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriverPtr driver,
virDomainMemoryDefPtr mem,
bool build)
{
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *path = NULL;
size_t i;
bool shouldBuildHP = false;
@@ -3902,7 +3879,6 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -3912,7 +3888,7 @@ qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainMemoryDefPtr mem)
{
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *path = NULL;
int ret = -1;
@@ -3927,7 +3903,6 @@ qemuProcessDestroyMemoryBackingPath(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -3967,7 +3942,7 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
virDomainGraphicsDefPtr graphics,
bool allocate)
{
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
unsigned short port = 0;
unsigned short tlsPort;
size_t i;
@@ -4052,7 +4027,6 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -4342,7 +4316,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
virDomainCapsCPUModelsPtr *cpuModels)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virDomainCapsCPUModelsPtr models = NULL;
+ g_autoptr(virDomainCapsCPUModels) models = NULL;
int rc;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
@@ -4357,7 +4331,6 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
return 0;
error:
- virObjectUnref(models);
return -1;
}
@@ -4369,7 +4342,7 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver,
{
virCPUDataPtr cpu = NULL;
virCPUDataPtr disabled = NULL;
- virDomainCapsCPUModelsPtr models = NULL;
+ g_autoptr(virDomainCapsCPUModels) models = NULL;
int ret = -1;
/* The host CPU model comes from host caps rather than QEMU caps so
@@ -4392,7 +4365,6 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver,
cleanup:
virCPUDataFree(cpu);
virCPUDataFree(disabled);
- virObjectUnref(models);
return ret;
}
@@ -4739,9 +4711,9 @@ static int
qemuProcessGetNetworkAddress(const char *netname,
char **netaddr)
{
- virConnectPtr conn = NULL;
+ g_autoptr(virConnect) conn = NULL;
int ret = -1;
- virNetworkPtr net;
+ g_autoptr(virNetwork) net = NULL;
virNetworkDefPtr netdef = NULL;
virNetworkIPDefPtr ipdef;
virSocketAddr addr;
@@ -4827,8 +4799,6 @@ qemuProcessGetNetworkAddress(const char *netname,
ret = 0;
cleanup:
virNetworkDefFree(netdef);
- virObjectUnref(net);
- virObjectUnref(conn);
return ret;
}
@@ -4865,7 +4835,7 @@ qemuProcessGraphicsSetupListen(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
const char *type = virDomainGraphicsTypeToString(graphics->type);
char *listenAddr = NULL;
bool useSocket = false;
@@ -4939,7 +4909,6 @@ qemuProcessGraphicsSetupListen(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -5658,7 +5627,7 @@ qemuProcessNetworkPrepareDevices(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
size_t i;
- virConnectPtr conn = NULL;
+ g_autoptr(virConnect) conn = NULL;
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
@@ -5711,7 +5680,6 @@ qemuProcessNetworkPrepareDevices(virQEMUDriverPtr driver,
}
ret = 0;
cleanup:
- virObjectUnref(conn);
return ret;
}
@@ -6251,7 +6219,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
int ret = -1;
size_t i;
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
priv->machineName = qemuDomainGetMachineName(vm);
if (!priv->machineName)
@@ -6355,7 +6323,6 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -6514,7 +6481,7 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver,
int ret = -1;
unsigned int hostdev_flags = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
if (qemuPrepareNVRAM(cfg, vm) < 0)
goto cleanup;
@@ -6603,7 +6570,6 @@ qemuProcessPrepareHost(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -6718,7 +6684,7 @@ qemuProcessLaunch(virConnectPtr conn,
qemuDomainObjPrivatePtr priv = vm->privateData;
virCommandPtr cmd = NULL;
struct qemuProcessHookData hookData;
- virQEMUDriverConfigPtr cfg;
+ g_autoptr(virQEMUDriverConfig) cfg = NULL;
size_t nnicindexes = 0;
g_autofree int *nicindexes = NULL;
size_t i;
@@ -7026,7 +6992,6 @@ qemuProcessLaunch(virConnectPtr conn,
qemuDomainSecretDestroy(vm);
virCommandFree(cmd);
virObjectUnref(logCtxt);
- virObjectUnref(cfg);
return ret;
}
@@ -7083,8 +7048,8 @@ qemuProcessFinishStartup(virQEMUDriverPtr driver,
bool startCPUs,
virDomainPausedReason pausedReason)
{
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
int ret = -1;
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
if (startCPUs) {
VIR_DEBUG("Starting domain CPUs");
@@ -7112,7 +7077,6 @@ qemuProcessFinishStartup(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -7348,8 +7312,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
const virNetDevVPortProfile *vport = NULL;
size_t i;
g_autofree char *timestamp = NULL;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- virConnectPtr conn = NULL;
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+ g_autoptr(virConnect) conn = NULL;
VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, "
"reason=%s, asyncJob=%s, flags=0x%x",
@@ -7664,8 +7628,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
cleanup:
virErrorRestore(&orig_err);
- virObjectUnref(conn);
- virObjectUnref(cfg);
}
@@ -7979,7 +7941,7 @@ qemuProcessReconnect(void *opaque)
qemuDomainJobObj oldjob;
int state;
int reason;
- virQEMUDriverConfigPtr cfg;
+ g_autoptr(virQEMUDriverConfig) cfg = NULL;
size_t i;
unsigned int stopFlags = 0;
bool jobStarted = false;
@@ -8227,7 +8189,6 @@ qemuProcessReconnect(void *opaque)
qemuDomainRemoveInactiveJob(driver, obj);
}
virDomainObjEndAPI(&obj);
- virObjectUnref(cfg);
virNWFilterUnlockFilterUpdates();
virIdentitySetCurrent(NULL);
return;
--
2.23.0