]> granicus.if.org Git - php/commitdiff
- Fixed memory leak in several Intl locale functions
authorFelipe Pena <felipe@php.net>
Tue, 22 Nov 2011 12:29:15 +0000 (12:29 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 22 Nov 2011 12:29:15 +0000 (12:29 +0000)
NEWS
ext/intl/locale/locale_methods.c

diff --git a/NEWS b/NEWS
index dd331e9b9b03fdc11d402e9ec8fef0c58a1fd022..b62459eecb4f0e6a0a3e7c4e67983a49d3542a80 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,27 @@ PHP                                                                        NEWS
   . Fixed bug #43200 (Interface implementation / inheritence not possible in
     abstract classes). (Felipe)
     
+- CLI SAPI:
+  . Fixed bug #60159 (Router returns false, but POST is not passed to requested
+    resource). (Laruence)
+  . Fixed bug #55759 (memory leak when using built-in server). (Laruence)
+
+- Improved PHP-FPM SAPI:
+  . Enhance error log when the primary script can't be open. FR #60199. (fat)
+  . Remove EXPERIMENTAL flag. (fat)
+  . Added .phar to default authorized extensions. (fat)
+
+- BCmath:
+  . Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
+  
+- Intl:
+  . Fixed memory leak in several Intl locale functions. (Felipe)
+  
+- Mbstring
+  . Fixed bug #60306 (Characters lost while converting from cp936 to utf8).
+    (Laruence)
+  . Fixed possible crash in mb_ereg_search_init() using empty pattern. (Felipe)
+  
 - MS SQL:
   . Fixed bug #60267 (Compile failure with freetds 0.91). (Felipe)
 
@@ -35,35 +56,17 @@ PHP                                                                        NEWS
   . Fixed bug #60282 (Segfault when using ob_gzhandler() with open buffers).
     (Laruence)
     
+- Reflection:
+  . Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string 
+    conversion"). (Laruence)
+    
 - SOAP extension:
   . Added new SoapClient option "keep_alive". FR #60329. (Pierrick)
-
+  
 - Tidy:
   . Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference).
     (Maksymilian Arciemowicz, Felipe)
 
-- Mbstring
-  . Fixed bug #60306 (Characters lost while converting from cp936 to utf8).
-    (Laruence)
-  . Fixed possible crash in mb_ereg_search_init() using empty pattern. (Felipe)
-
-- CLI SAPI:
-  . Fixed bug #60159 (Router returns false, but POST is not passed to requested
-    resource). (Laruence)
-  . Fixed bug #55759 (memory leak when using built-in server). (Laruence)
-
-- Improved PHP-FPM SAPI:
-  . Enhance error log when the primary script can't be open. FR #60199. (fat)
-  . Remove EXPERIMENTAL flag. (fat)
-  . Added .phar to default authorized extensions. (fat)
-
-- BCmath:
-  . Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
-
-- Reflection:
-  . Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string 
-    conversion"). (Laruence)
-
 11 Nov 2011, PHP 5.4.0 RC1
 - General improvements:
   . Changed silent conversion of array to string to produce a notice. (Patrick)
index 88522339be0d88d69a98ff9743493bce316e373c..39d162a5107afcd683d4139295088306797163d6 100755 (executable)
@@ -470,6 +470,7 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
 
        char*       disp_loc_name       = NULL;
        int         disp_loc_name_len   = 0;
+       int         free_loc_name       = 0;
 
        UChar*      disp_name           = NULL;
        int32_t     disp_name_len       = 0;
@@ -517,17 +518,18 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
        if( mod_loc_name==NULL ){
                mod_loc_name = estrdup( loc_name );
        }
+       
+       /* Check if disp_loc_name passed , if not use default locale */
+       if( !disp_loc_name){
+               disp_loc_name = estrdup(INTL_G(default_locale));
+               free_loc_name = 1;
+       }
 
     /* Get the disp_value for the given locale */
     do{
         disp_name = erealloc( disp_name , buflen  );
         disp_name_len = buflen;
 
-        /* Check if disp_loc_name passed , if not use default locale */
-        if( !disp_loc_name){
-            disp_loc_name = estrdup(INTL_G(default_locale));
-        }
-
                if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
                        buflen = uloc_getDisplayLanguage ( mod_loc_name , disp_loc_name , disp_name , disp_name_len , &status);
                } else if( strcmp(tag_name , LOC_SCRIPT_TAG)==0 ){
@@ -557,6 +559,10 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
                        if( mod_loc_name){
                                efree( mod_loc_name );
                        }
+                       if (free_loc_name) {
+                               efree(disp_loc_name);
+                               disp_loc_name = NULL;
+                       }
                        RETURN_FALSE;
                }
        } while( buflen > disp_name_len );
@@ -564,6 +570,10 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
        if( mod_loc_name){
                efree( mod_loc_name );
        }
+       if (free_loc_name) {
+               efree(disp_loc_name);
+               disp_loc_name = NULL;
+       }
        /* Convert display locale name from UTF-16 to UTF-8. */
        intl_convert_utf16_to_utf8( &utf8value, &utf8value_len, disp_name, buflen, &status );
        efree( disp_name );