From: Daniel P. Berrange Date: Tue, 24 Sep 2013 15:44:26 +0000 (+0100) Subject: Fix leak of char device in xenParseXM X-Git-Tag: v1.1.3-rc1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa911ec44e4e7a83a7213ed711d281e47148dfb0;p=thirdparty%2Flibvirt.git Fix leak of char device in xenParseXM If an OOM occurs in xenParseXM, a virDomainChrDef may be leaked. Signed-off-by: Daniel P. Berrange --- diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 1ffea8469c..4386fefa67 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -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;