[PATCH 04/17] Fix leak in virDomainDefParseXML parsing vcpupin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

If virBitmapNew fails due to OOM, the 'vcpupin' variable
is leaked.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index aab6781..4ff7593 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11192,8 +11192,10 @@ virDomainDefParseXML(xmlDocPtr xml,
             if (VIR_ALLOC(vcpupin) < 0)
                 goto error;
 
-            if (!(vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN)))
+            if (!(vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN))) {
+                VIR_FREE(vcpupin);
                 goto error;
+            }
             virBitmapCopy(vcpupin->cpumask, def->cpumask);
             vcpupin->vcpuid = i;
             def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]