From 9af159903dbf2799f16d8b83e8e556583aabd3e2 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 28 Feb 2014 19:25:51 +0000 Subject: [PATCH] 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). --- scope.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.c b/scope.c index d326220..4c4f527 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 */ -- 2.7.4