Skip to content

Commit 0be13d2

Browse files
paresyJulien Pauli
authored and
Julien Pauli
committed
fix bug #72024 (microtime() leaks memory)
1 parent bfc4221 commit 0be13d2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ext/standard/string.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ static char *php_hex2bin(const unsigned char *old, const size_t oldlen, size_t *
195195
* glibc's localeconv is not reentrant, so lets make it so ... sorta */
196196
PHPAPI struct lconv *localeconv_r(struct lconv *out)
197197
{
198-
struct lconv *res;
199198

200199
# ifdef ZTS
201200
tsrm_mutex_lock( locale_mutex );
@@ -206,16 +205,14 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
206205
/* Even with the enabled per thread locale, localeconv
207206
won't check any locale change in the master thread. */
208207
_locale_t cur = _get_current_locale();
209-
210-
res = cur->locinfo->lconv;
208+
*out = *cur->locinfo->lconv;
209+
_free_locale(cur);
211210
}
212211
#else
213212
/* localeconv doesn't return an error condition */
214-
res = localeconv();
213+
*out = *localeconv();
215214
#endif
216215

217-
*out = *res;
218-
219216
# ifdef ZTS
220217
tsrm_mutex_unlock( locale_mutex );
221218
# endif

0 commit comments

Comments
 (0)