]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix crash on OOM in parsing CPU mask in domain XML
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 23 Sep 2013 13:08:35 +0000 (14:08 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Sep 2013 09:51:28 +0000 (10:51 +0100)
The virDomainDefParseXML method did not check the return value
of the virBitmapNew API call for NULL. This lead to a crash on
OOM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/conf/domain_conf.c

index 73ae0b0a64b05d5b6d893b0b9b6cc52dd852112b..240f318936f245c1c9d346f37396628d6356ebca 100644 (file)
@@ -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;