This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #123960] sv.c: Fix gp_free -Do output
authorFather Chrysostomos <sprout@cpan.org>
Mon, 2 Mar 2015 06:42:04 +0000 (22:42 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 2 Mar 2015 06:42:26 +0000 (22:42 -0800)
We try to print ‘gp_free clearing PL_stashcache for '%"HEKf"'’, but
without checking that we actually have a hek.  This has been this way
since 103f5a36127.

gv.c

diff --git a/gv.c b/gv.c
index 41cebeb..2eb18e4 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -2540,9 +2540,12 @@ Perl_gp_free(pTHX_ GV *gv)
          Somehow gp->gp_hv can end up pointing at freed garbage.  */
       if (hv && SvTYPE(hv) == SVt_PVHV) {
         const HEK *hvname_hek = HvNAME_HEK(hv);
-        DEBUG_o(Perl_deb(aTHX_ "gp_free clearing PL_stashcache for '%"HEKf"'\n", HEKfARG(hvname_hek)));
-        if (PL_stashcache && hvname_hek)
+        if (PL_stashcache && hvname_hek) {
+           DEBUG_o(Perl_deb(aTHX_
+                          "gp_free clearing PL_stashcache for '%"HEKf"'\n",
+                           HEKfARG(hvname_hek)));
            (void)hv_deletehek(PL_stashcache, hvname_hek, G_DISCARD);
+        }
        SvREFCNT_dec(hv);
       }
       if (io && SvREFCNT(io) == 1 && IoIFP(io)