Fix a memory leak when compiling a long regular expression

This commit is contained in:
Petr Písař 2020-08-27 13:53:49 +02:00
parent d6f9e4d2d3
commit e6a0a682a2
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 6841cd5977c2d35ad75233734c66983a65613fce Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Wed, 12 Aug 2020 17:53:52 -0600
Subject: [PATCH] Fix leak GH #18054
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This was a simple matter of one path failing to free the memory.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
regcomp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/regcomp.c b/regcomp.c
index addf375450..01f297c299 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -15191,6 +15191,8 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
FAIL2("panic: loc_correspondence[%d] is 0",
(int) (s - s_start));
}
+ Safefree(locfold_buf);
+ Safefree(loc_correspondence);
}
else {
upper_fill = s - s0;
--
2.25.4

View File

@ -225,6 +225,10 @@ Patch31: perl-5.33.0-list-assign-in-list-context-was-over-optimising.patc
# in upstream after 5.33.0
Patch32: perl-5.33.0-list-assign-in-list-context-honour-LHS-undef.patch
# Fix a memory leak when compiling a long regular expression, GH#18054,
# in upstream after 5.33.0
Patch33: perl-5.33.0-Fix-leak-GH-18054.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -4244,6 +4248,7 @@ you're not running VMS, this module does nothing.
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch200 -p1
%patch201 -p1
@ -4283,6 +4288,7 @@ perl -x patchlevel.h \
'Fedora Patch30: Fix inheritance resolution of lexial objects in a debugger (GH#17661)' \
'Fedora Patch31: Fix a misoptimization when assignig a list in a list context (GH#17816)' \
'Fedora Patch32: Fix handling left-hand-side undef when assigning a list (GH#16685)' \
'Fedora Patch33: Fix a memory leak when compiling a long regular expression (GH#18054)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -7000,6 +7006,7 @@ popd
- Fix inheritance resolution of lexial objects in a debugger (GH#17661)
- Fix a misoptimization when assignig a list in a list context (GH#17816)
- Fix handling left-hand-side undef when assigning a list (GH#16685)
- Fix a memory leak when compiling a long regular expression (GH#18054)
* Fri Aug 21 2020 Jeff Law <law@redhat.com> - 4:5.32.0-461
- Re-enable LTO