1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

Fix double free of hostdev on OOM in xenParseSxprPCI

If xenParseSxprPCI failed to expand the def->hostdevs array
due to OOM, it would free the hostdev instance twice.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-09-25 10:20:45 +01:00
parent 3debed1bbd
commit 0dff76c2d3

View File

@ -1055,10 +1055,8 @@ xenParseSxprPCI(virDomainDefPtr def,
dev->source.subsys.u.pci.addr.slot = slotID;
dev->source.subsys.u.pci.addr.function = funcID;
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
virDomainHostdevDefFree(dev);
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0)
goto error;
}
def->hostdevs[def->nhostdevs++] = dev;
}