This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #40389] perl_destruct() leaks PL_defstash
[perl5.git] / perl.c
diff --git a/perl.c b/perl.c
index a04cfd6..860cdfc 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1042,6 +1042,8 @@ perl_destruct(pTHXx)
     /* Prepare to destruct main symbol table.  */
 
     hv = PL_defstash;
+    /* break ref loop  *:: <=> %:: */
+    (void)hv_delete(hv, "main::", 6, G_DISCARD);
     PL_defstash = 0;
     SvREFCNT_dec(hv);
     SvREFCNT_dec(PL_curstname);