]> granicus.if.org Git - php/commitdiff
fix leak on error
authorAntony Dovgal <tony2001@php.net>
Thu, 21 Dec 2006 01:13:50 +0000 (01:13 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 21 Dec 2006 01:13:50 +0000 (01:13 +0000)
ext/standard/html.c

index 840becdff7ae57ef1c23959c8a100298aa17588f..529b1d62a232a788f86088bbfde1662e284b2e10 100644 (file)
@@ -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);