This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfb8f08
)
fix a memory leak in sv_sethek(), amending 70b71ec84
author
Fuji, Goro
<g.psy.va@gmail.com>
Tue, 31 Jul 2012 12:56:11 +0000
(21:56 +0900)
committer
Father Chrysostomos
<sprout@cpan.org>
Wed, 1 Aug 2012 05:12:05 +0000
(22:12 -0700)
the following code reproduced this issue on perl 5.16.0:
my $o = bless {};
while (1) {
for my $r([], $o) {
ref $r;
}
}
sv.c
patch
|
blob
|
blame
|
history
diff --git
a/sv.c
b/sv.c
index
1bccaae
..
b0eaf92
100644
(file)
--- a/
sv.c
+++ b/
sv.c
@@
-4553,6
+4553,7
@@
Perl_sv_sethek(pTHX_ register SV *const sv, const HEK *const hek)
{
SV_CHECK_THINKFIRST_COW_DROP(sv);
SvUPGRADE(sv, SVt_PV);
+ Safefree(SvPVX(sv));
SvPV_set(sv,(char *)HEK_KEY(share_hek_hek(hek)));
SvCUR_set(sv, HEK_LEN(hek));
SvLEN_set(sv, 0);