This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_regcomp(): fix refcnt issue with qr_anoncv
authorDavid Mitchell <davem@iabyn.com>
Wed, 23 Nov 2011 14:19:52 +0000 (14:19 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 13 Jun 2012 12:32:45 +0000 (13:32 +0100)
Assigning to qr_anoncv was introduced a few commits ago, but
I forgot to increase the reference count

pp_ctl.c

index 1e23a7a..24a0d3e 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -118,7 +118,7 @@ PP(pp_regcomp)
                (pm->op_pmflags & (RXf_PMf_COMPILETIME|PMf_HAS_CV)));
     if (pm->op_pmflags & PMf_HAS_CV)
        ((struct regexp *)SvANY(new_re))->qr_anoncv
-                                       = (CV*) PAD_SV(PL_op->op_targ);
+                       = (CV*) SvREFCNT_inc(PAD_SV(PL_op->op_targ));
 
     if (is_bare_re) {
        REGEXP *tmp;