This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix coredump in /(?{sub{}})/
authorDave Mitchell <davem@fdisolutions.com>
Sat, 6 Mar 2004 15:25:32 +0000 (15:25 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Sat, 6 Mar 2004 15:25:32 +0000 (15:25 +0000)
p4raw-id: //depot/perl@22445

pad.c

diff --git a/pad.c b/pad.c
index 316833d..f2c7777 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -257,8 +257,11 @@ Perl_pad_undef(pTHX_ CV* cv)
                CV *innercv = (CV*)curpad[ix];
                namepad[ix] = Nullsv;
                SvREFCNT_dec(namesv);
-               curpad[ix] = Nullsv;
-               SvREFCNT_dec(innercv);
+
+               if (SvREFCNT(comppad) < 2) { /* allow for /(?{ sub{} })/  */
+                   curpad[ix] = Nullsv;
+                   SvREFCNT_dec(innercv);
+               }
                if (SvREFCNT(innercv) /* in use, not just a prototype */
                    && CvOUTSIDE(innercv) == cv)
                {