]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Avoid leak if virDomainSoundCodecDefParseXML return error
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 24 Sep 2013 15:10:49 +0000 (16:10 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:49:12 +0000 (15:49 +0100)
If virDomainSoundCodecDefParseXML returns an error (eg due
to OOM), then the xml nodeset codecNodes is leaked.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/conf/domain_conf.c

index 152672acf1297977161f2215326a5eeef722d0c8..002b980b23664c793ffeb599fb5fc68c586fbadd 100644 (file)
@@ -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;