1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-11 21:41:53 +03:00

malloc-fail: Fix memory leak in htmlCreateMemoryParserCtxt

Found with libFuzzer, see #344.
This commit is contained in:
Nick Wellnhofer
2023-02-16 14:47:41 +01:00
parent 643b4e90eb
commit fc256953d2

View File

@ -5227,7 +5227,10 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) {
return(NULL);
buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
if (buf == NULL) return(NULL);
if (buf == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
}
input = xmlNewInputStream(ctxt);
if (input == NULL) {