In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/ac6d2595875ea2813009c120fd54eb70c9ed2b0a?hp=ae999eaf3df1ac7396ec3e133b04a95e1c7bc0ea>
- Log ----------------------------------------------------------------- commit ac6d2595875ea2813009c120fd54eb70c9ed2b0a Author: Tony Cook <[email protected]> Date: Wed Feb 6 15:42:10 2019 +1100 (perl #133660) add test for goto &sub in overload leaking The bug in this case was fixed in db9848c8d. ----------------------------------------------------------------------- Summary of changes: t/op/svleak.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/op/svleak.t b/t/op/svleak.t index 3283c95cbf..bfa6747a02 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -15,7 +15,7 @@ BEGIN { use Config; -plan tests => 149; +plan tests => 150; # run some code N times. If the number of SVs at the end of loop N is # greater than (N-1)*delta at the end of loop 1, we've got a leak @@ -625,3 +625,23 @@ SKIP: { sub Regex_Key_Leak { my ($r)= keys %rh; "foo"=~$r; } leak 2, 0, \&Regex_Key_Leak,"RT #132892 - regex patterns should not leak"; } + +{ + # perl #133660 + fresh_perl_is(<<'PERL', "ok", {}, "check goto core sub doesn't leak"); +# done this way to avoid overloads for all of svleak.t +use B; +BEGIN { + *CORE::GLOBAL::open = sub (*;$@) { + goto \&CORE::open; + }; +} + +my $refcount; +{ + open(my $fh, '<', 'TEST'); + my $sv = B::svref_2object($fh); + print $sv->REFCNT == 1 ? "ok" : "not ok"; +} +PERL +} -- Perl5 Master Repository
