From: Dmitry Stogov Date: Mon, 15 Aug 2005 08:11:35 +0000 (+0000) Subject: Fixed trim()'s memory leak in unicode mode X-Git-Tag: PRE_NEW_OCI8_EXTENSION~254 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70614052496098e2fc3b1bde1ff7cc6ee9bb0e1a;p=php Fixed trim()'s memory leak in unicode mode --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 1b9cff5398..5b67852569 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -713,17 +713,18 @@ static UChar *php_u_trim(UChar *c, int32_t len, UChar *what, int32_t what_len, z if ( start < len ) { if ( return_value ) { RETVAL_UNICODEL(c+start, end-start+1, 1); + return NULL; } else { return eustrndup(c+start, end-start+1); } } else { /* Trimmed the whole string */ if ( return_value ) { RETVAL_EMPTY_UNICODE(); + return NULL; } else { return (USTR_MAKE("")); } } - return (USTR_MAKE("")); } /* }}} */