This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Teach win32/Makefile 'test_porting'
[perl5.git] / regcomp.c
index 9e9fac4..56b2b9c 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5409,7 +5409,8 @@ Perl_reg_named_buff_fetch(pTHX_ REGEXP * const r, SV * const namesv,
                     if (!retarray)
                         return ret;
                 } else {
-                    ret = newSVsv(&PL_sv_undef);
+                    if (retarray)
+                        ret = newSVsv(&PL_sv_undef);
                 }
                 if (retarray)
                     av_push(retarray, ret);
@@ -5418,10 +5419,6 @@ Perl_reg_named_buff_fetch(pTHX_ REGEXP * const r, SV * const namesv,
                 return newRV_noinc(MUTABLE_SV(retarray));
         }
     }
-
-    if (ret)
-        SvREFCNT_dec(ret);
-
     return NULL;
 }