mirror of https://gitee.com/openkylin/libvirt.git
Introduce virXMLValidatorFree
Split out the code cleaning up the validator.
This commit is contained in:
parent
71c68b40df
commit
8657c7a12f
|
@ -2565,6 +2565,7 @@ virXMLPickShellSafeComment;
|
|||
virXMLPropString;
|
||||
virXMLSaveFile;
|
||||
virXMLValidateAgainstSchema;
|
||||
virXMLValidatorFree;
|
||||
virXPathBoolean;
|
||||
virXPathInt;
|
||||
virXPathLong;
|
||||
|
|
|
@ -1161,11 +1161,21 @@ virXMLValidateAgainstSchema(const char *schemafile,
|
|||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virXMLValidatorFree(validator);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virXMLValidatorFree(virXMLValidatorPtr validator)
|
||||
{
|
||||
if (!validator)
|
||||
return;
|
||||
|
||||
VIR_FREE(validator->schemafile);
|
||||
virBufferFreeAndReset(&validator->buf);
|
||||
xmlRelaxNGFreeParserCtxt(validator->rngParser);
|
||||
xmlRelaxNGFreeValidCtxt(validator->rngValid);
|
||||
xmlRelaxNGFree(validator->rng);
|
||||
VIR_FREE(validator);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -192,5 +192,7 @@ typedef virXMLValidator *virXMLValidatorPtr;
|
|||
int
|
||||
virXMLValidateAgainstSchema(const char *schemafile,
|
||||
xmlDocPtr xml);
|
||||
void
|
||||
virXMLValidatorFree(virXMLValidatorPtr validator);
|
||||
|
||||
#endif /* __VIR_XML_H__ */
|
||||
|
|
Loading…
Reference in New Issue