Change 34209 by [EMAIL PROTECTED] on 2008/08/20 23:15:36 [perl #56908] DBI memory leak in 5.10.0 due to change 26530 A weakref to a HV would leak, because the xhv_backreferences array is created with a refcount of 2 (to avoid premature freeing during global destruction), but the RC was only decremented once when the parent HV was freed. Also, when thread cloned, the new array was being created with a RC of 1, rather than 2, which coincidentally worked due to the first bug.
Affected files ... ... //depot/perl/hv.c#377 edit ... //depot/perl/sv.c#1549 edit Differences ... ==== //depot/perl/hv.c#377 (text) ==== Index: perl/hv.c --- perl/hv.c#376~34190~ 2008-08-09 03:04:55.000000000 -0700 +++ perl/hv.c 2008-08-20 16:15:36.000000000 -0700 @@ -1985,6 +1985,7 @@ if (av) { HvAUX(hv)->xhv_backreferences = 0; Perl_sv_kill_backrefs(aTHX_ (SV*) hv, av); + SvREFCNT_dec(av); } } ==== //depot/perl/sv.c#1549 (text) ==== Index: perl/sv.c --- perl/sv.c#1548~34144~ 2008-07-15 07:51:53.000000000 -0700 +++ perl/sv.c 2008-08-20 16:15:36.000000000 -0700 @@ -10784,10 +10784,11 @@ 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 End of Patch.