1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00

Fix memory leak

This commit is contained in:
Anatol Belski
2018-08-17 16:22:35 +02:00
parent aa7777d36c
commit 0414fff205

View File

@@ -2175,11 +2175,16 @@ PHP_FUNCTION(dom_document_save_html)
}
buf = xmlBufferCreate();
outBuf = xmlOutputBufferCreateBuffer(buf, NULL);
if (!outBuf || !buf) {
if (!buf) {
php_error_docref(NULL, E_WARNING, "Could not fetch buffer");
RETURN_FALSE;
}
outBuf = xmlOutputBufferCreateBuffer(buf, NULL);
if (!outBuf) {
xmlBufferFree(buf);
php_error_docref(NULL, E_WARNING, "Could not fetch output buffer");
RETURN_FALSE;
}
if (node->type == XML_DOCUMENT_FRAG_NODE) {
for (node = node->children; node; node = node->next) {
@@ -2205,6 +2210,7 @@ PHP_FUNCTION(dom_document_save_html)
RETVAL_FALSE;
}
xmlOutputBufferClose(outBuf);
xmlBufferFree(buf);
} else {
int size = 0;
#if LIBXML_VERSION >= 20623