1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-26 14:03:49 +03:00

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 <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-09-24 16:10:49 +01:00
parent fbf8e1c314
commit 1fff45cca9

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