diff options
author | Karl Williamson <khw@cpan.org> | 2021-02-27 11:43:41 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-02-28 08:14:03 -0700 |
commit | 5f41fa466a67b5535aa8bcf4b814f242545ac7bd (patch) | |
tree | 63014b828dbb69a848a650330c84dfd4b4664fbc /regcomp.c | |
parent | 553cc101838a8c491686b81e3ac6cc4417c40139 (diff) | |
download | perl-5f41fa466a67b5535aa8bcf4b814f242545ac7bd.tar.gz |
regcomp.c: Remove memory leak
This fixes GH #18604. There was a path through the code where a
particular SV did not get its reference count decremented.
I did an audit of the function and came up with several other
possiblities that are included in this commit.
Further, there would be leaks for some instances of finding syntax
errors in the input pattern, or when warnings are fatalized. Those
would require mortalizing some SVs, but that is beyond the scope of this
commit.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -18765,6 +18765,12 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, RExC_end = save_end; RExC_in_multi_char_class = 0; SvREFCNT_dec_NN(multi_char_matches); + SvREFCNT_dec(properties); + SvREFCNT_dec(cp_list); + SvREFCNT_dec(simple_posixes); + SvREFCNT_dec(posixes); + SvREFCNT_dec(nposixes); + SvREFCNT_dec(cp_foldable_list); return ret; } @@ -20122,6 +20128,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, RExC_parse - orig_parse);; SvREFCNT_dec(cp_list);; SvREFCNT_dec(only_utf8_locale_list); + SvREFCNT_dec(upper_latin1_only_utf8_matches); return ret; } |