This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #115830] Fix crash by not copying DESTROY cache
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index 5447ac6..9f5c157 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12002,6 +12002,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
                    SvMAGIC_set(dstr, mg_dup(SvMAGIC(dstr), param));
                if (SvSTASH(dstr))
                    SvSTASH_set(dstr, hv_dup_inc(SvSTASH(dstr), param));
+               else SvSTASH_set(dstr, 0); /* don't copy DESTROY cache */
            }
 
            /* The cast silences a GCC warning about unhandled types.  */