Okay, here's your official unofficial closure leak patch
Larry Wall [Tue, 14 Mar 1995 23:25:31 +0000 (12:25 +1300)]
op.c
pp.c

diff --git a/op.c b/op.c
index 3866792..b1f867f 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2676,7 +2676,7 @@ CV* proto;
     comppadlist = newAV();
     AvREAL_off(comppadlist);
     av_store(comppadlist, 0, SvREFCNT_inc((SV*)protopad_name));
-    av_store(comppadlist, 1, SvREFCNT_inc((SV*)comppad));
+    av_store(comppadlist, 1, (SV*)comppad);
     CvPADLIST(cv) = comppadlist;
     av_extend(comppad, AvFILL(protopad));
     curpad = AvARRAY(comppad);
diff --git a/pp.c b/pp.c
index 51287e1..16e47b6 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -270,7 +270,7 @@ PP(pp_anoncode)
     EXTEND(SP,1);
 
     if (SvFLAGS(cv) & SVpcv_CLONE) {
-       cv = cv_clone(cv);
+       cv = (CV*)sv_2mortal((SV*)cv_clone(cv));
     }
 
     PUSHs((SV*)cv);