summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-11-12 15:34:55 +0000
committerDavid Mitchell <davem@iabyn.com>2019-11-12 15:34:55 +0000
commitecfd8588da8b6d2b74d6476d4d1c9e40c7de8b8c (patch)
tree07c2383d509bb5afd6e4c407a1b1523faff9dc47
parentf0206e819891ea9f375f3443e0a4d3ccf02acac8 (diff)
downloadperl-ecfd8588da8b6d2b74d6476d4d1c9e40c7de8b8c.tar.gz
remove leak in tr/ascii/utf8/
The recent change to use invlists left a bug in S_do_trans_invmap() whereby it allocated a new temp buf if it knew the resulting string would be too long, but failed to free the buffer at the end. Showed up as smokes under ASAN failing these tests: op/tr_latin1.t op/tr.t uni/tr_utf8.t
-rw-r--r--doop.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/doop.c b/doop.c
index 6db986b86b..3e62c8cf3b 100644
--- a/doop.c
+++ b/doop.c
@@ -523,6 +523,7 @@ S_do_trans_invmap(pTHX_ SV * const sv, AV * const invmap)
s += s_len;
if (! inplace) {
sv_setpvn(sv, (char*)d0, d - d0);
+ Safefree(d0);
}
else {
*d = '\0';