summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmlschemas.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/xmlschemas.c b/xmlschemas.c
index a4eaf591..4662ebbf 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -29098,9 +29098,18 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
/*
* prepare the parser
*/
- pctxt = xmlNewSAXParserCtxt(sax, user_data);
- if (pctxt == NULL)
- return (-1);
+ if (sax != NULL) {
+ pctxt = xmlNewSAXParserCtxt(sax, user_data);
+ if (pctxt == NULL)
+ return (-1);
+ } else {
+ pctxt = xmlNewParserCtxt();
+ if (pctxt == NULL)
+ return (-1);
+ /* We really want pctxt->sax to be NULL here. */
+ xmlFree(pctxt->sax);
+ pctxt->sax = NULL;
+ }
#if 0
if (options)
xmlCtxtUseOptions(pctxt, options);