PL_defoutgv could be used after being freed
Dave Mitchell [Thu, 29 Sep 2005 22:57:44 +0000 (22:57 +0000)]
Was giving "use of freed value" warnings in t/io/through.t
and t/io/crlf_through.t

p4raw-id: //depot/perl@25665

perl.c

diff --git a/perl.c b/perl.c
index fc0972c..caa58d3 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -739,6 +739,8 @@ perl_destruct(pTHXx)
         */
        sv_clean_objs();
        PL_sv_objcount = 0;
+       if (PL_defoutgv && !SvREFCNT(PL_defoutgv))
+           PL_defoutgv = Nullgv; /* may have been freed */
     }
 
     /* unhook hooks which will soon be, or use, destroyed data */