diff options
author | Karl Williamson <khw@cpan.org> | 2016-04-09 20:40:48 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-05-24 10:26:29 -0600 |
commit | 3c5f993ee8b2fd0912839a82e5d7d8c871a363ea (patch) | |
tree | c06f804d11335471e95a97a5956dabccdf95f4a4 /locale.c | |
parent | 4ebeff162503a0f3c404305458e4730ff29f1dea (diff) | |
download | perl-3c5f993ee8b2fd0912839a82e5d7d8c871a363ea.tar.gz |
locale.c: Free over-allocated space early
We may over malloc some space in buffers to strxfrm(). This frees it
now instead of waiting for the whole block to be freed sometime later.
This can be a significant amount of memory if the input string to
strxfrm() is long.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1465,6 +1465,8 @@ Perl_mem_collxfrm(pTHX_ const char *input_string, *xlen = xout - sizeof(PL_collation_ix); + /* Free up unneeded space; retain ehough for trailing NUL */ + Renew(xbuf, xout + 1, char); if (s != input_string) { Safefree(s); |