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:
parent
71c68b40df
commit
8657c7a12f
@ -2565,6 +2565,7 @@ virXMLPickShellSafeComment;
|
|||||||
virXMLPropString;
|
virXMLPropString;
|
||||||
virXMLSaveFile;
|
virXMLSaveFile;
|
||||||
virXMLValidateAgainstSchema;
|
virXMLValidateAgainstSchema;
|
||||||
|
virXMLValidatorFree;
|
||||||
virXPathBoolean;
|
virXPathBoolean;
|
||||||
virXPathInt;
|
virXPathInt;
|
||||||
virXPathLong;
|
virXPathLong;
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
@ -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__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user