summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 6c9fd2aa2e..bfa2c2e667 100644
--- 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;