diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-12-08 09:58:31 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-12-09 18:47:18 -0800 |
commit | d4f87935b315c22d0c227786e8c86afa52067dc7 (patch) | |
tree | 4447767d98884e8416578a8b2c5069f155d92322 /hv.c | |
parent | e7881358a40c0c95ec67889ca179bd8ca552060a (diff) | |
download | perl-d4f87935b315c22d0c227786e8c86afa52067dc7.tar.gz |
hv.c: hv_undef: Don’t set mro fields to null before freeing
There is no point in modifying a struct just before freeing it.
This was my mistake, in commit 47f1cf7702, when I moved the code from
S_hfreeentries to hv_undef.
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -1753,16 +1753,14 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 flags) } if((meta = aux->xhv_mro_meta)) { if (meta->mro_linear_all) { - SvREFCNT_dec(MUTABLE_SV(meta->mro_linear_all)); - meta->mro_linear_all = NULL; - /* This is just acting as a shortcut pointer. */ - meta->mro_linear_current = NULL; - } else if (meta->mro_linear_current) { + SvREFCNT_dec_NN(meta->mro_linear_all); + /* mro_linear_current is just acting as a shortcut pointer, + hence the else. */ + } + else /* Only the current MRO is stored, so this owns the data. */ SvREFCNT_dec(meta->mro_linear_current); - meta->mro_linear_current = NULL; - } SvREFCNT_dec(meta->mro_nextmethod); SvREFCNT_dec(meta->isa); Safefree(meta); |