io: Report malloc failure in xmlOutputBufferWrite

Fixes #676.
This commit is contained in:
Nick Wellnhofer 2024-02-01 11:51:58 +01:00
parent 2835337a1a
commit 0d170acaba

View File

@ -2431,8 +2431,10 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
}
}
ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk);
if (ret != 0)
if (ret != 0) {
out->error = XML_ERR_NO_MEMORY;
return(-1);
}
if ((xmlBufUse(out->buffer) < MINLEN) && (chunk == len))
goto done;