From: Daniel P. Berrange Date: Tue, 24 Sep 2013 15:10:49 +0000 (+0100) Subject: Avoid leak if virDomainSoundCodecDefParseXML return error X-Git-Tag: v1.1.3-rc1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fff45cca91b97f27a4991a610a8e92bbd0b067f;p=thirdparty%2Flibvirt.git Avoid leak if virDomainSoundCodecDefParseXML return error If virDomainSoundCodecDefParseXML returns an error (eg due to OOM), then the xml nodeset codecNodes is leaked. Signed-off-by: Daniel P. Berrange --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 152672acf1..002b980b23 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8472,8 +8472,10 @@ virDomainSoundDefParseXML(const xmlNodePtr node, for (i = 0; i < ncodecs; i++) { virDomainSoundCodecDefPtr codec = virDomainSoundCodecDefParseXML(codecNodes[i]); - if (codec == NULL) + if (codec == NULL) { + VIR_FREE(codecNodes); goto error; + } codec->cad = def->ncodecs; /* that will do for now */ def->codecs[def->ncodecs++] = codec;