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

[libvirt] [PATCH 02/10] Fix crash on OOM in parsing CPU mask in domain XML

From: "Daniel P. Berrange" <berrange redhat com>

The virDomainDefParseXML method did not check the return value
of the virBitmapNew API call for NULL. This lead to a crash on

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 73ae0b0..240f318 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11188,7 +11188,8 @@ virDomainDefParseXML(xmlDocPtr xml,
             if (VIR_ALLOC(vcpupin) < 0)
                 goto error;
-            vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
+            if (!(vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN)))
+                goto error;
             virBitmapCopy(vcpupin->cpumask, def->cpumask);
             vcpupin->vcpuid = i;
             def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;

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