From: Dave Mitchell Date: Sun, 25 Jan 2004 12:00:04 +0000 (+0000) Subject: add test for change 22209 (Remove small memory leak in newATTRSUB) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=154b970cb4fe96ef863c55bd5e330d17252e0208;p=p5sagit%2Fp5-mst-13.2.git add test for change 22209 (Remove small memory leak in newATTRSUB) p4raw-id: //depot/perl@22215 --- diff --git a/t/op/closure.t b/t/op/closure.t index f9da311..4d560f6 100755 --- a/t/op/closure.t +++ b/t/op/closure.t @@ -13,7 +13,7 @@ BEGIN { use Config; -print "1..186\n"; +print "1..187\n"; my $test = 1; sub test (&) { @@ -678,6 +678,23 @@ __EOF__ test { $got eq 'ok' }; } +# After newsub is redefined outside the BEGIN, it's CvOUTSIDE should point +# to main rather than BEGIN, and BEGIN should be freed. + +{ + my $flag = 0; + sub X::DESTROY { $flag = 1 } + { + my $x; + BEGIN {$x = \&newsub } + sub newsub {}; + $x = bless {}, 'X'; + } + test { $flag == 1 }; +} + + +