summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-05-10 13:52:48 +0100
committerDavid Mitchell <davem@iabyn.com>2011-05-19 14:49:43 +0100
commit272e8453abcb0fceb34b1464670386e03a1f55bb (patch)
treee06fc67e14ac4c401993d61552405b9b42bf1e00 /hv.c
parentf350200ecf1b0467f7149472cc5aeee9c4d176d1 (diff)
downloadperl-272e8453abcb0fceb34b1464670386e03a1f55bb.tar.gz
hv_free_ent: free SV as last action
Move the freeing of the SV from near the beginning to the end of hv_free_ent(); i.e. free the HE before the SV. Ideally, this should cause no change in behaviour, but will make using an iterative HV freeing scheme easier.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index 20c3531536..e78f84f132 100644
--- a/hv.c
+++ b/hv.c
@@ -1470,7 +1470,6 @@ Perl_hv_free_ent(pTHX_ HV *hv, register HE *entry)
val = HeVAL(entry);
if (val && isGV(val) && isGV_with_GP(val) && GvCVu(val) && HvENAME(hv))
mro_method_changed_in(hv); /* deletion of method from stash */
- SvREFCNT_dec(val);
if (HeKLEN(entry) == HEf_SVKEY) {
SvREFCNT_dec(HeKEY_sv(entry));
Safefree(HeKEY_hek(entry));
@@ -1480,6 +1479,7 @@ Perl_hv_free_ent(pTHX_ HV *hv, register HE *entry)
else
Safefree(HeKEY_hek(entry));
del_HE(entry);
+ SvREFCNT_dec(val);
}