diff options
-rw-r--r-- | hv.c | 1 | ||||
-rw-r--r-- | sv.c | 3 |
2 files changed, 3 insertions, 1 deletions
@@ -1985,6 +1985,7 @@ Perl_hv_kill_backrefs(pTHX_ HV *hv) { if (av) { HvAUX(hv)->xhv_backreferences = 0; Perl_sv_kill_backrefs(aTHX_ (SV*) hv, av); + SvREFCNT_dec(av); } } @@ -10784,10 +10784,11 @@ Perl_sv_dup(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) daux->xhv_eiter = saux->xhv_eiter ? he_dup(saux->xhv_eiter, (bool)!!HvSHAREKEYS(sstr), param) : 0; + /* backref array needs refcnt=2; see sv_add_backref */ daux->xhv_backreferences = saux->xhv_backreferences ? (AV*) SvREFCNT_inc( - sv_dup((SV*)saux->xhv_backreferences, param)) + sv_dup_inc((SV*)saux->xhv_backreferences, param)) : 0; daux->xhv_mro_meta = saux->xhv_mro_meta |