This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Remove memory leak
authorKarl Williamson <khw@cpan.org>
Sat, 27 Feb 2021 18:43:41 +0000 (11:43 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 28 Feb 2021 15:14:03 +0000 (08:14 -0700)
commit5f41fa466a67b5535aa8bcf4b814f242545ac7bd
tree63014b828dbb69a848a650330c84dfd4b4664fbc
parent553cc101838a8c491686b81e3ac6cc4417c40139
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.
regcomp.c
t/op/svleak.t