summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index c6c3a5e265..8f338ae926 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -20277,6 +20277,9 @@ Perl_pregfree2(pTHX_ REGEXP *rx)
PERL_ARGS_ASSERT_PREGFREE2;
+ if (! r)
+ return;
+
if (r->mother_re) {
ReREFCNT_dec(r->mother_re);
} else {
@@ -20422,6 +20425,10 @@ Perl_regfree_internal(pTHX_ REGEXP * const rx)
PERL_ARGS_ASSERT_REGFREE_INTERNAL;
+ if (! ri) {
+ return;
+ }
+
DEBUG_COMPILE_r({
if (!PL_colorset)
reginitcolors();