Split out the code cleaning up the validator. --- src/libvirt_private.syms | 1 + src/util/virxml.c | 13 ++++++++++++- src/util/virxml.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f197f55..53a7a97 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2565,6 +2565,7 @@ virXMLPickShellSafeComment; virXMLPropString; virXMLSaveFile; virXMLValidateAgainstSchema; +virXMLValidatorFree; virXPathBoolean; virXPathInt; virXPathLong; diff --git a/src/util/virxml.c b/src/util/virxml.c index b3e4184..49aed7d 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1161,10 +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); - return ret; + VIR_FREE(validator); } diff --git a/src/util/virxml.h b/src/util/virxml.h index b75b109..607f063 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -190,5 +190,7 @@ typedef struct _virXMLValidator { int virXMLValidateAgainstSchema(const char *schemafile, xmlDocPtr xml); +void +virXMLValidatorFree(virXMLValidatorPtr validator); #endif /* __VIR_XML_H__ */ -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list