fixing a deallocation problem in xmlRelaxNGParse() in case of errors,
* relaxng.c: fixing a deallocation problem in xmlRelaxNGParse()
in case of errors, should fix bug #338306
Daniel
diff --git a/relaxng.c b/relaxng.c
index 59780c8..45eef13 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -7394,13 +7394,16 @@
if (root == NULL) {
xmlRngPErr(ctxt, (xmlNodePtr) doc,
XML_RNGP_EMPTY, "xmlRelaxNGParse: %s is empty\n",
- ctxt->URL, NULL);
- xmlFreeDoc(doc);
+ (ctxt->URL ? ctxt->URL : "schemas"), NULL);
+
+ xmlFreeDoc(ctxt->document);
+ ctxt->document = NULL;
return (NULL);
}
ret = xmlRelaxNGParseDocument(ctxt, root);
if (ret == NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(ctxt->document);
+ ctxt->document = NULL;
return (NULL);
}