summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-02-28 19:25:51 +0000
committerDavid Mitchell <davem@iabyn.com>2014-02-28 19:39:23 +0000
commit9af159903dbf2799f16d8b83e8e556583aabd3e2 (patch)
treed0538941c0f01aae6d885e49b66ae72db4759520 /scope.c
parent7532eaaef8da50c2ccee274667a2fa4a3dd6e349 (diff)
downloadperl-9af159903dbf2799f16d8b83e8e556583aabd3e2.tar.gz
SAVEt_CLEARSV: only clear-in-place if RC==1
Currently it takes the 'clear-in-place' branch on lexical vars if the ref count is <= 1. However, RC < 1 is a "should never happen" condition, so rather than keeping that damaged var, take the other branch, which will call SvREFCNT_dec() on it, which will Do the Right Thing (like emitting a warning).
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index d32622062d..4c4f5274d0 100644
--- a/scope.c
+++ b/scope.c
@@ -1039,7 +1039,7 @@ Perl_leave_scope(pTHX_ I32 base)
assert(SvPADMY(sv));
/* Can clear pad variable in place? */
- if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
+ if (SvREFCNT(sv) == 1 && !SvOBJECT(sv)) {
/* these flags are the union of all the relevant flags
* in the individual conditions within */