From: Vincent Pit Date: Sat, 29 Nov 2008 21:45:27 +0000 (+0100) Subject: Fix leaks of cloned coderefs that access lexicals X-Git-Tag: v0.26~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=83145d113a2bd8dd5c753431076b65cc9da8951a;p=perl%2Fmodules%2FVariable-Magic.git Fix leaks of cloned coderefs that access lexicals --- diff --git a/Magic.xs b/Magic.xs index b486760..ec49843 100644 --- a/Magic.xs +++ b/Magic.xs @@ -809,8 +809,8 @@ STATIC SV *vmg_wizard_wiz(pTHX_ SV *wiz) { #if VMG_THREADSAFE #define VMG_CLONE_CB(N) \ - z->cb_ ## N = (w->cb_ ## N) ? newRV_noinc(vmg_clone(SvRV(w->cb_ ## N), \ - w->owner)) \ + z->cb_ ## N = (w->cb_ ## N) ? newRV_inc(vmg_clone(SvRV(w->cb_ ## N), \ + w->owner)) \ : NULL; STATIC MGWIZ *vmg_wizard_clone(pTHX_ const MGWIZ *w) { diff --git a/t/41-clone.t b/t/41-clone.t index e5ae498..c3c4822 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -26,7 +26,6 @@ if (VMG_THREADSAFE) { diag "Using threads $v" if defined $v; $v = $threads::shared::VERSION; diag "Using threads::shared $v" if defined $v; - diag 'This will leak a few scalars'; } else { plan skip_all => 'This Variable::Magic isn\'t thread safe'; }