diff options
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1043,6 +1043,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, if (d_flags & G_DISCARD) { sv = HeVAL(entry); + HeVAL(entry) = &PL_sv_placeholder; if (sv) { /* deletion of method from stash */ if (isGV(sv) && isGV_with_GP(sv) && GvCVu(sv) @@ -1051,8 +1052,11 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, SvREFCNT_dec(sv); sv = NULL; } - } else sv = sv_2mortal(HeVAL(entry)); - HeVAL(entry) = &PL_sv_placeholder; + } + else { + sv = sv_2mortal(HeVAL(entry)); + HeVAL(entry) = &PL_sv_placeholder; + } /* * If a restricted hash, rather than really deleting the entry, put |