1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-05 05:47:00 +03:00

reader: Don't call xmlCtxtErrMemory with NULL ctxt

This can happen in "walker" mode.
This commit is contained in:
Nick Wellnhofer 2024-05-05 18:16:44 +02:00
parent a39e862b96
commit 81611e06da

View File

@ -40,6 +40,7 @@
#endif
#include "private/buf.h"
#include "private/error.h"
#include "private/tree.h"
#include "private/parser.h"
#ifdef LIBXML_XINCLUDE_ENABLED
@ -181,7 +182,10 @@ static void xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur);
static void
xmlTextReaderErrMemory(xmlTextReaderPtr reader) {
xmlCtxtErrMemory(reader->ctxt);
if (reader->ctxt != NULL)
xmlCtxtErrMemory(reader->ctxt);
else
xmlRaiseMemoryError(NULL, NULL, NULL, XML_FROM_PARSER, NULL);
reader->mode = XML_TEXTREADER_MODE_ERROR;
reader->state = XML_TEXTREADER_ERROR;
}