summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/pad.c b/pad.c
index 06cadbb259..7d7b5eb131 100644
--- a/pad.c
+++ b/pad.c
@@ -363,16 +363,20 @@ Perl_cv_undef(pTHX_ CV *cv)
}
ix = AvFILLp(padlist);
- while (ix >= 0) {
+ while (ix > 0) {
SV* const sv = AvARRAY(padlist)[ix--];
if (sv) {
- if (sv == (const SV *)PL_comppad_name)
- PL_comppad_name = NULL;
- else if (sv == (const SV *)PL_comppad) {
+ if (sv == (const SV *)PL_comppad) {
PL_comppad = NULL;
PL_curpad = NULL;
}
+ SvREFCNT_dec(sv);
}
+ }
+ {
+ SV *const sv = AvARRAY(padlist)[0];
+ if (sv == (const SV *)PL_comppad_name)
+ PL_comppad_name = NULL;
SvREFCNT_dec(sv);
}
SvREFCNT_dec(MUTABLE_SV(CvPADLIST(cv)));