summaryrefslogtreecommitdiff
path: root/ext/mbstring/mbregex.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/mbregex.c')
-rw-r--r--ext/mbstring/mbregex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/mbstring/mbregex.c b/ext/mbstring/mbregex.c
index ae42042f72..34a0550cb4 100644
--- a/ext/mbstring/mbregex.c
+++ b/ext/mbstring/mbregex.c
@@ -1446,6 +1446,9 @@ re_compile_pattern(pattern, size, bufp)
snprintf(error_msg, ERROR_MSG_MAX_SIZE,
"invalid regular expression; there's no previous pattern, to which '%c' would define cardinality at %d",
c, p-pattern);
+ if (bufp->buffer) {
+ xfree(bufp->buffer);
+ }
FREE_AND_RETURN(stackb, error_msg);
}
/* If there is a sequence of repetition chars,