summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/op.c b/op.c
index 08e2ed4727..6e4252781f 100644
--- a/op.c
+++ b/op.c
@@ -4180,7 +4180,8 @@ Perl_cv_undef(pTHX_ CV *cv)
* apply to closures generated within eval"", since eval"" CVs are
* ephemeral. --GSAR */
if (!CvANON(cv) || CvCLONED(cv)
- || (CvOUTSIDE(cv) && CvEVAL(CvOUTSIDE(cv)) && !CvGV(CvOUTSIDE(cv))))
+ || (CvOUTSIDE(cv) && SvTYPE(CvOUTSIDE(cv)) == SVt_PVCV
+ && CvEVAL(CvOUTSIDE(cv)) && !CvGV(CvOUTSIDE(cv))))
{
SvREFCNT_dec(CvOUTSIDE(cv));
}
@@ -4828,7 +4829,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
* lifetime of the outer CV. Avoids memory leak due to reference
* loop. --GSAR */
if (!name && CvOUTSIDE(cv)
- && !(CvEVAL(CvOUTSIDE(cv)) && !CvGV(CvOUTSIDE(cv))))
+ && !(SvTYPE(CvOUTSIDE(cv)) == SVt_PVCV
+ && CvEVAL(CvOUTSIDE(cv)) && !CvGV(CvOUTSIDE(cv))))
{
SvREFCNT_dec(CvOUTSIDE(cv));
}