Fix crash on OOM in parsing CPU mask in domain XML

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>
This commit is contained in:
Daniel P. Berrange 2013-09-23 14:08:35 +01:00
parent a50de5d827
commit 182d5ed331

View File

@ -11188,7 +11188,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (VIR_ALLOC(vcpupin) < 0) if (VIR_ALLOC(vcpupin) < 0)
goto error; goto error;
vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN); if (!(vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN)))
goto error;
virBitmapCopy(vcpupin->cpumask, def->cpumask); virBitmapCopy(vcpupin->cpumask, def->cpumask);
vcpupin->vcpuid = i; vcpupin->vcpuid = i;
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin; def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;