com php-src: fix bug #72024 (microtime() leaks memory): ext/standard/string.c
| From: | JulienPauli | Date: | Fri, 08 Jul 2016 12:36:44 +0000 |
| Subject: | com php-src: fix bug #72024 (microtime() leaks memory): ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92876@lists.php.net to get a copy of this message | ||
Commit: 0be13d2dc24f2802a231f92912ba5d089dad6676
Author: Michael Maroszek <maroszek@gmx.net> Thu, 7 Jul 2016 14:24:05 +0200
Committer: Julien Pauli <jpauli@php.net> Fri, 8 Jul 2016 14:36:44 +0200
Parents: bfc42211d3cc5aa6cd2bdb10ef5004ce22099acb
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0be13d2dc24f2802a231f92912ba5d089dad6676
Log:
fix bug #72024 (microtime() leaks memory)
Bugs:
https://bugs.php.net/72024
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 39413c8..1ecbdb9 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -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