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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user