]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Fix leaks of cloned coderefs that access lexicals
authorVincent Pit <vince@profvince.com>
Sat, 29 Nov 2008 21:45:27 +0000 (22:45 +0100)
committerVincent Pit <vince@profvince.com>
Sat, 29 Nov 2008 21:45:27 +0000 (22:45 +0100)
Magic.xs
t/41-clone.t

index b4867605f663a9ed86efe80a24a64b807cd1cb5d..ec49843183def6fa826c8f2edd5e5d5712f11a7c 100644 (file)
--- 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) {
index e5ae4986d2a10fa7dc655c59e2e269fb7d524be2..c3c48223ed666c5d9760cb109ff186f8c3133ddd 100644 (file)
@@ -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';
 }