aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-08-26 21:26:56 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-08-26 21:26:56 +0300
commitb52b7b9f65b0edfe28f0b16a4aa72f1b76cf8820 (patch)
tree3a316a8f66444a3ac616eb68c02c296888759587 /regcomp.c
parent5167f5aaabb5adb4801be9f46ba3ba16596014c3 (diff)
downloadegawk-b52b7b9f65b0edfe28f0b16a4aa72f1b76cf8820.tar.gz
egawk-b52b7b9f65b0edfe28f0b16a4aa72f1b76cf8820.tar.bz2
egawk-b52b7b9f65b0edfe28f0b16a4aa72f1b76cf8820.zip
Sync regex with GLIBC.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index a62364c9..9774ae50 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2215,7 +2215,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
branch = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && branch == NULL, 0))
- return NULL;
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
}
else
branch = NULL;
@@ -2476,8 +2480,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
|| token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
{
- bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token,
- syntax, err);
+ bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
if (BE (*err != REG_NOERROR && dup_tree == NULL, 0))
{
if (tree != NULL)
@@ -2640,6 +2643,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
/* Duplicate ELEM before it is marked optional. */
elem = duplicate_tree (elem, dfa);
+ if (BE (elem == NULL, 0))
+ goto parse_dup_op_espace;
old_tree = tree;
}
else
@@ -3136,8 +3141,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
if (BE (sbcset == NULL, 0))
#endif /* RE_ENABLE_I18N */
{
-#ifdef RE_ENABLE_I18N
re_free (sbcset);
+#ifdef RE_ENABLE_I18N
re_free (mbcset);
#endif
*err = REG_ESPACE;