From 6c37ee4da28917db115dab7e0cf2e6a4f23d72de Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 18 Nov 2019 17:39:46 +0100 Subject: [PATCH] qemuProcessStop: Set @def early The @def variable holds pointer to the domain defintion, but is set only somewhere in the middle of the function. This is suboptimal. Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- src/qemu/qemu_process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 90ebdb43a0..209d07cfe8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7331,7 +7331,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, int retries = 0; qemuDomainObjPrivatePtr priv = vm->privateData; virErrorPtr orig_err; - virDomainDefPtr def; + virDomainDefPtr def = vm->def; virNetDevVPortProfilePtr vport = NULL; size_t i; char *timestamp; @@ -7386,7 +7386,6 @@ void qemuProcessStop(virQEMUDriverPtr driver, virDomainConfVMNWFilterTeardown(vm); if (cfg->macFilter) { - def = vm->def; for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; if (net->ifname == NULL) @@ -7483,7 +7482,6 @@ void qemuProcessStop(virQEMUDriverPtr driver, qemuHostdevReAttachDomainDevices(driver, vm->def); - def = vm->def; for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; vport = virDomainNetGetActualVirtPortProfile(net); -- GitLab