summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-06-22 23:46:36 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-06-22 23:46:36 +0000
commitefa785391fea9e6aff4c999b27ad62b7d8f9ea99 (patch)
treee3d0ba3c1dc82782a9efac32a4b9858418fdd3ca /pad.c
parentebbf13f2d6b71e644ff7236eeae62f89a124f231 (diff)
downloadperl-efa785391fea9e6aff4c999b27ad62b7d8f9ea99.tar.gz
safely handle cloning a stale lexical var
This code: my $x if ...; sub { $x} could attempt to clone $x even if $x is stale. p4raw-id: //depot/perl@31447
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pad.c b/pad.c
index 51592d0937..07f994ae49 100644
--- a/pad.c
+++ b/pad.c
@@ -1501,8 +1501,8 @@ Perl_cv_clone(pTHX_ CV *proto)
"Variable \"%s\" is not available", SvPVX_const(namesv));
sv = NULL;
}
- else {
- assert(!SvPADSTALE(sv));
+ /* 'my $x if $y' can leave $x stale even in an active sub */
+ else if (!SvPADSTALE(sv)) {
SvREFCNT_inc_simple_void_NN(sv);
}
}