]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix memory leak in qemuConnectGetAllDomainStats error path
authorJohn Ferlan <jferlan@redhat.com>
Wed, 7 Mar 2018 14:43:30 +0000 (09:43 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 8 Mar 2018 13:54:02 +0000 (08:54 -0500)
If we return -1 on VIR_ALLOC_N failure, we leaked @vms, so
goto cleanup instead.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_driver.c

index 9e715e7a00d484fb7863d0aced71c841607a9434..e13544f83238c7d35098744109335201a9124bf1 100644 (file)
@@ -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;