diff options
Diffstat (limited to 'xmlreader.c')
-rw-r--r-- | xmlreader.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/xmlreader.c b/xmlreader.c index 864abf0a..ef41927e 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -5401,8 +5401,11 @@ xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); return (NULL); + } reader = xmlNewTextReader(input, URL); if (reader == NULL) { xmlFreeParserInputBuffer(input); @@ -5619,10 +5622,14 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread, input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (-1); + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); + return (NULL); + } return (xmlTextReaderSetup(reader, input, URL, encoding, options)); } + /************************************************************************ * * * Utilities * |