From: John Ferlan Date: Wed, 7 Mar 2018 14:43:30 +0000 (-0500) Subject: qemu: Fix memory leak in qemuConnectGetAllDomainStats error path X-Git-Tag: v4.2.0-rc1~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b1ec66cde6ada5ff4fc018f17a6ae887c0b72af;p=thirdparty%2Flibvirt.git qemu: Fix memory leak in qemuConnectGetAllDomainStats error path If we return -1 on VIR_ALLOC_N failure, we leaked @vms, so goto cleanup instead. Signed-off-by: John Ferlan --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9e715e7a00..e13544f832 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20348,7 +20348,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, } if (VIR_ALLOC_N(tmpstats, nvms + 1) < 0) - return -1; + goto cleanup; if (qemuDomainGetStatsNeedMonitor(stats)) privflags |= QEMU_DOMAIN_STATS_HAVE_JOB;