mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix leak of char device in xenParseXM
If an OOM occurs in xenParseXM, a virDomainChrDef may be leaked. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -1080,8 +1080,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||
if (!(chr = xenParseSxprChar(port, NULL)))
|
||||
goto cleanup;
|
||||
|
||||
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0)
|
||||
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
|
||||
virDomainChrDefFree(chr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
|
||||
chr->target.port = portnum;
|
||||
|
||||
Reference in New Issue
Block a user