Plug a memory leak (noticed by Yves)
Rafael Garcia-Suarez [Thu, 7 Jun 2007 16:09:54 +0000 (16:09 +0000)]
p4raw-id: //depot/perl@31352

regcomp.c

index 6c9fd2a..bfa2c2e 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4883,7 +4883,9 @@ Perl_reg_named_buff_exists(pTHX_ REGEXP * const rx, SV * const key,
         if (flags & RXf_HASH_ALL) {
             return hv_exists_ent(rx->paren_names, key, 0);
         } else {
-            if (CALLREG_NAMED_BUFF_FETCH(rx, key, flags)) {
+           SV *sv = CALLREG_NAMED_BUFF_FETCH(rx, key, flags);
+            if (sv) {
+               SvREFCNT_dec(sv);
                 return TRUE;
             } else {
                 return FALSE;