From: Antony Dovgal Date: Thu, 21 Dec 2006 01:13:50 +0000 (+0000) Subject: fix leak on error X-Git-Tag: RELEASE_1_0_0RC1~585 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2b3141df216fd12d7a5306780903ed384722a0d;p=php fix leak on error --- diff --git a/ext/standard/html.c b/ext/standard/html.c index 840becdff7..529b1d62a2 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -955,7 +955,8 @@ PHPAPI char *php_unescape_html_entities(char *orig, int oldlen, int *newlen, int default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot yet handle MBCS!"); - return 0; + efree(ret); + return NULL; } if (php_memnstr(ret, entity, entity_length, ret+retlen)) { @@ -1365,6 +1366,10 @@ PHP_FUNCTION(html_entity_decode) replaced = php_unescape_html_entities(str.s, str_len, &len, 1, quote_style, hint_charset TSRMLS_CC); + if (!replaced) { + RETURN_FALSE; + } + if (type == IS_UNICODE) { RETVAL_U_STRINGL(UG(utf8_conv), replaced, len, ZSTR_AUTOFREE); efree(str_utf8);