
On 05/25/2017 04:20 AM, Yi Wang wrote:
The @meminfo allocated in qemuMonitorGetMemoryDeviceInfo may be lost when exit monitor failed. Luckily we can free it according to rc.
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> --- src/qemu/qemu_domain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c8dc748..c34ec5a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5767,8 +5767,11 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
rc = qemuMonitorGetMemoryDeviceInfo(priv->mon, &meminfo);
- if (qemuDomainObjExitMonitor(driver, vm) < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0) { + if (0 == rc)
We don't use this style in libvirt. Moreover, there's no real need for the check as virHashFree() accepts NULL happily.
+ virHashFree(meminfo); return -1; + }
/* if qemu doesn't support the info request, just carry on */ if (rc == -2)
I've fixed that, ACKed and pushed. Michal