summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-05-03 17:16:29 +0100
committerDavid Mitchell <davem@iabyn.com>2011-05-19 14:49:43 +0100
commitf350200ecf1b0467f7149472cc5aeee9c4d176d1 (patch)
tree37d86b8b27230ecf49c109761091757b8d5319bf /sv.c
parentef60ac00626a1b26275244b3fa3ce49a3223baba (diff)
downloadperl-f350200ecf1b0467f7149472cc5aeee9c4d176d1.tar.gz
HV backrefs: another simplification
Now that HV backrefs are only stored in HvAUX, don't go looking for them in magic too in sv_clear()
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 534638c5fe..8a663173be 100644
--- a/sv.c
+++ b/sv.c
@@ -6054,9 +6054,12 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
if (type >= SVt_PVMG) {
/* Free back-references before magic, in case the magic calls
* Perl code that has weak references to sv. */
- if (type == SVt_PVHV)
+ if (type == SVt_PVHV) {
Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv));
- if (type == SVt_PVMG && SvPAD_OUR(sv)) {
+ if (SvMAGIC(sv))
+ mg_free(sv);
+ }
+ else if (type == SVt_PVMG && SvPAD_OUR(sv)) {
SvREFCNT_dec(SvOURSTASH(sv));
} else if (SvMAGIC(sv)) {
/* Free back-references before other types of magic. */