summaryrefslogtreecommitdiff
path: root/t/op/grep.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-08 18:14:03 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-08 23:13:36 -0800
commit55b5114f4ff694ab871173b736aa2d48bb095684 (patch)
tree8258cd178c80da1a45ea12f0e511f1668822e798 /t/op/grep.t
parentbbff98dc509eb269f4500b2698d1ab918152f9d2 (diff)
downloadperl-55b5114f4ff694ab871173b736aa2d48bb095684.tar.gz
[perl #92254, #92256] Fix SAVE_DEFSV to do refcounting
The current definition of SAVE_DEFSV doesn’t take reference count- ing into account. Every instance of it in the perl core is buggy as a result. Most are also followed by DEFSV_set, which is likewise buggy. This commit implements SAVE_DEFSV in terms of save_gp and SAVEGENERICSV if PERL_CORE is defined. save_gp and SAVEGENERICSV are what local(*_) = \$foo uses. Changing the definition for XS code is probably too risky this close to 5.16. It should probably be changed later, though. DEFSV_set is now changed to do reference counting too.
Diffstat (limited to 't/op/grep.t')
-rw-r--r--t/op/grep.t10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/op/grep.t b/t/op/grep.t
index 0a1f8c9090..94fa43cf6c 100644
--- a/t/op/grep.t
+++ b/t/op/grep.t
@@ -10,7 +10,7 @@ BEGIN {
require "test.pl";
}
-plan( tests => 61 );
+plan( tests => 62 );
{
my @lol = ([qw(a b c)], [], [qw(1 2 3)]);
@@ -214,3 +214,11 @@ plan( tests => 61 );
like($@, qr/Missing comma after first argument to grep function/,
"proper error on variable as block. [perl #37314]");
}
+
+# [perl #92254] freeing $_ in gremap block
+{
+ my $y;
+ grep { undef *_ } $y;
+ map { undef *_ } $y;
+}
+pass 'no double frees with grep/map { undef *_ }';