Fix use-after-free in handling domain taint flags

* src/conf/domain_conf.c: Fix use after free
This commit is contained in:
Daniel P. Berrange 2011-06-22 17:33:10 +01:00
parent caf808c790
commit abb82f53ed

View File

@ -6731,12 +6731,13 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
char *str = virXMLPropString(nodes[i], "flag");
if (str) {
int flag = virDomainTaintTypeFromString(str);
VIR_FREE(str);
if (flag < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown taint flag %s"), str);
VIR_FREE(str);
goto error;
}
VIR_FREE(str);
virDomainObjTaint(obj, flag);
}
}