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:
Daniel P. Berrange 2013-09-24 16:44:26 +01:00
parent 145de7b8f3
commit fa911ec44e

View File

@ -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;