[perl #40388] perl_destruct() leaks PL_main_cv
authorDavid Mitchell <davem@iabyn.com>
Sun, 19 Sep 2010 11:49:07 +0000 (12:49 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 20 Sep 2010 07:16:12 +0000 (08:16 +0100)
Well yes, it does, kinda; but it's harmless. Add a comment to that effect.

perl.c

diff --git a/perl.c b/perl.c
index 860cdfc..79e87a5 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -751,6 +751,10 @@ perl_destruct(pTHXx)
        PL_main_root = NULL;
     }
     PL_main_start = NULL;
        PL_main_root = NULL;
     }
     PL_main_start = NULL;
+    /* note that  PL_main_cv isn't usually actually freed at this point,
+     * due to the CvOUTSIDE refs from subs compiled within it. It will
+     * get freed once all the subs are freed in sv_clean_all(), for
+     * destruct_level > 0 */
     SvREFCNT_dec(PL_main_cv);
     PL_main_cv = NULL;
     PL_dirty = TRUE;
     SvREFCNT_dec(PL_main_cv);
     PL_main_cv = NULL;
     PL_dirty = TRUE;