]> granicus.if.org Git - php/commitdiff
fix bug #72024 (microtime() leaks memory)
authorMichael Maroszek <maroszek@gmx.net>
Thu, 7 Jul 2016 12:24:05 +0000 (14:24 +0200)
committerJulien Pauli <jpauli@php.net>
Fri, 8 Jul 2016 12:36:44 +0000 (14:36 +0200)
ext/standard/string.c

index 39413c8211707e669d2bb7c0321d65c23f57b22c..1ecbdb97ce01f50d887ec92a513273bf5a746e21 100644 (file)
@@ -195,7 +195,6 @@ static char *php_hex2bin(const unsigned char *old, const size_t oldlen, size_t *
  * glibc's localeconv is not reentrant, so lets make it so ... sorta */
 PHPAPI struct lconv *localeconv_r(struct lconv *out)
 {
-       struct lconv *res;
 
 # ifdef ZTS
        tsrm_mutex_lock( locale_mutex );
@@ -206,16 +205,14 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
                /* Even with the enabled per thread locale, localeconv
                        won't check any locale change in the master thread. */
                _locale_t cur = _get_current_locale();
-
-               res = cur->locinfo->lconv;
+               *out = *cur->locinfo->lconv;
+               _free_locale(cur);
        }
 #else
        /* localeconv doesn't return an error condition */
-       res = localeconv();
+       *out = *localeconv();
 #endif
 
-       *out = *res;
-
 # ifdef ZTS
        tsrm_mutex_unlock( locale_mutex );
 # endif