virDomainChrDefParseXML: don't leak upon invalid input

* src/conf/domain_conf.c (virDomainChrDefParseXML): Don't leak a
virDomainChrDef buffer upon "unknown target type for char device" error.
This commit is contained in:
Jim Meyering 2010-02-04 12:49:53 +01:00
parent 6eed3feafb
commit 04ebf058d5

View File

@ -1947,6 +1947,7 @@ virDomainChrDefParseXML(virConnectPtr conn,
virDomainReportError(conn, VIR_ERR_XML_ERROR,
_("unknown target type for character device: %s"),
nodeName);
VIR_FREE(def);
return NULL;
}
def->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_NULL;