1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-24 09:49:22 +03:00

Memory error within SAX2 reuse common framework

There is no reason for that class of errors to not use
the same handling allowing strctured error processing.
This commit is contained in:
Daniel Veillard
2012-07-18 16:05:37 +08:00
parent c508fa3f0b
commit 740cb1a450

21
SAX2.c
View File

@ -57,12 +57,29 @@
*/
static void
xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {
xmlStructuredErrorFunc schannel = NULL;
const char *str1 = "out of memory\n";
if (ctxt != NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg);
ctxt->errNo = XML_ERR_NO_MEMORY;
if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
__xmlRaiseError(schannel,
ctxt->vctxt.error, ctxt->vctxt.userData,
ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
XML_ERR_ERROR, NULL, 0, (const char *) str1,
NULL, NULL, 0, 0,
msg, (const char *) str1, NULL);
ctxt->errNo = XML_ERR_NO_MEMORY;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
} else {
__xmlRaiseError(schannel,
NULL, NULL,
ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
XML_ERR_ERROR, NULL, 0, (const char *) str1,
NULL, NULL, 0, 0,
msg, (const char *) str1, NULL);
}
}