From: Alex Jia <ajia(a)redhat.com>
Detected by Coverity. Leaks introduced in commit 93ab585 and
commit e8d6b29.
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_driver.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fbaa824..6a1e7cc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6014,6 +6014,7 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
}
if (j != ndevices) {
ret = -1;
+ VIR_FREE(devices);
continue;
}
if (qemuDomainMergeDeviceWeights(&vm->def->blkio.devices,
@@ -7867,7 +7868,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
virDomainDefPtr persistentDef = NULL;
int ret = -1;
virDomainNetDefPtr net = NULL, persistentNet = NULL;
- virNetDevBandwidthPtr bandwidth = NULL;
+ virNetDevBandwidthPtr bandwidth = NULL, newBandwidth = NULL;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -7989,8 +7990,6 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- virNetDevBandwidthPtr newBandwidth;
-
if (VIR_ALLOC(newBandwidth) < 0) {
virReportOOMError();
goto cleanup;
@@ -8056,6 +8055,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
ret = 0;
cleanup:
virNetDevBandwidthFree(bandwidth);
+ virNetDevBandwidthFree(newBandwidth);
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
--
1.7.1