1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

Introduce virXMLValidatorFree

Split out the code cleaning up the validator.
This commit is contained in:
Ján Tomko 2016-06-07 18:57:29 +02:00
parent 71c68b40df
commit 8657c7a12f
3 changed files with 14 additions and 1 deletions

View File

@ -2565,6 +2565,7 @@ virXMLPickShellSafeComment;
virXMLPropString; virXMLPropString;
virXMLSaveFile; virXMLSaveFile;
virXMLValidateAgainstSchema; virXMLValidateAgainstSchema;
virXMLValidatorFree;
virXPathBoolean; virXPathBoolean;
virXPathInt; virXPathInt;
virXPathLong; virXPathLong;

View File

@ -1161,11 +1161,21 @@ virXMLValidateAgainstSchema(const char *schemafile,
ret = 0; ret = 0;
cleanup: cleanup:
virXMLValidatorFree(validator);
return ret;
}
void
virXMLValidatorFree(virXMLValidatorPtr validator)
{
if (!validator)
return;
VIR_FREE(validator->schemafile); VIR_FREE(validator->schemafile);
virBufferFreeAndReset(&validator->buf); virBufferFreeAndReset(&validator->buf);
xmlRelaxNGFreeParserCtxt(validator->rngParser); xmlRelaxNGFreeParserCtxt(validator->rngParser);
xmlRelaxNGFreeValidCtxt(validator->rngValid); xmlRelaxNGFreeValidCtxt(validator->rngValid);
xmlRelaxNGFree(validator->rng); xmlRelaxNGFree(validator->rng);
VIR_FREE(validator); VIR_FREE(validator);
return ret;
} }

View File

@ -192,5 +192,7 @@ typedef virXMLValidator *virXMLValidatorPtr;
int int
virXMLValidateAgainstSchema(const char *schemafile, virXMLValidateAgainstSchema(const char *schemafile,
xmlDocPtr xml); xmlDocPtr xml);
void
virXMLValidatorFree(virXMLValidatorPtr validator);
#endif /* __VIR_XML_H__ */ #endif /* __VIR_XML_H__ */