This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix #78266: Memory leak with named regexp captures.
authorJohannes Plunien <plu@pqpq.de>
Tue, 13 Dec 2011 07:39:52 +0000 (11:39 +0400)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 13 Dec 2011 17:03:01 +0000 (09:03 -0800)
regcomp.c

index b1b8e6f..9e9fac4 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5418,6 +5418,10 @@ 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;
 }