diff options
author | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2008-07-18 06:36:09 +0000 |
---|---|---|
committer | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2008-07-18 06:36:09 +0000 |
commit | ec83ea38ebd7a9cbfbb0209243d3f52270074917 (patch) | |
tree | fa070f6949f1a80e883e7c81cbeecda5592952ad /regcomp.c | |
parent | 4271b52731a6686853855c0f41ce04f915a2e02e (diff) | |
download | perl-ec83ea38ebd7a9cbfbb0209243d3f52270074917.tar.gz |
Welcome to refcount hell. Fix the leaks reported by #57024
along with a bunch other named capture related leaks.
p4raw-id: //depot/perl@34151
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -4985,13 +4985,11 @@ Perl_reg_named_buff_fetch(pTHX_ REGEXP * const r, SV * const namesv, } else { ret = newSVsv(&PL_sv_undef); } - if (retarray) { - SvREFCNT_inc_simple_void(ret); + if (retarray) av_push(retarray, ret); - } } if (retarray) - return newRV((SV*)retarray); + return newRV_noinc((SV*)retarray); } } return NULL; @@ -5088,6 +5086,7 @@ Perl_reg_named_buff_scalar(pTHX_ REGEXP * const r, const U32 flags) ret = CALLREG_NAMED_BUFF_ALL(r, (flags | RXapif_REGNAMES)); av = (AV*)SvRV(ret); length = av_len(av); + SvREFCNT_dec(ret); return newSViv(length + 1); } else { Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_scalar", (int)flags); @@ -5129,7 +5128,7 @@ Perl_reg_named_buff_all(pTHX_ REGEXP * const r, const U32 flags) } } - return newRV((SV*)av); + return newRV_noinc((SV*)av); } void |