
On Tue, Jun 07, 2016 at 20:07:29 +0200, Ján Tomko wrote:
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,
[...]
+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);
This actually belongs to the previous patch. ^^ Otherwise it will be leaking the validator struct in the first patch.
}
ACK with the above fixed.