summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2008-08-20 23:15:36 +0000
committerDave Mitchell <davem@fdisolutions.com>2008-08-20 23:15:36 +0000
commitb17f5ab768c4daa8faac6c85c0c20d3895f406e1 (patch)
tree2075faf38f83ac6d5dd27e4d078117ff91d7956d /hv.c
parent7ee5fac837a8a4ebf1956da1b1d252aa82fe506d (diff)
downloadperl-b17f5ab768c4daa8faac6c85c0c20d3895f406e1.tar.gz
[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. p4raw-id: //depot/perl@34209
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hv.c b/hv.c
index 3d4d3af183..24d9150e28 100644
--- a/hv.c
+++ b/hv.c
@@ -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);
}
}