]> xenbits.xensource.com Git - libvirt.git/commitdiff
Introduce virXMLValidatorFree
authorJán Tomko <jtomko@redhat.com>
Tue, 7 Jun 2016 16:57:29 +0000 (18:57 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Jun 2016 07:58:54 +0000 (09:58 +0200)
Split out the code cleaning up the validator.

src/libvirt_private.syms
src/util/virxml.c
src/util/virxml.h

index f197f55d3593e4834c216d623a6a21faff7a0fe7..53a7a9780da47759ff835dfda2e7338e48a0c996 100644 (file)
@@ -2565,6 +2565,7 @@ virXMLPickShellSafeComment;
 virXMLPropString;
 virXMLSaveFile;
 virXMLValidateAgainstSchema;
+virXMLValidatorFree;
 virXPathBoolean;
 virXPathInt;
 virXPathLong;
index 7842273972c9b24c6d83d2ca19919a8e8126a87b..49aed7d7770f79860b3fc4b3e27ae9f444a93a29 100644 (file)
@@ -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;
 }
index 9803be53609aad7d3747608ed3b2dc244706a5a8..21ca578691c412d50d4d0fdb04eb5cc93804fe2e 100644 (file)
@@ -192,5 +192,7 @@ typedef virXMLValidator *virXMLValidatorPtr;
 int
 virXMLValidateAgainstSchema(const char *schemafile,
                             xmlDocPtr xml);
+void
+virXMLValidatorFree(virXMLValidatorPtr validator);
 
 #endif                          /* __VIR_XML_H__ */