aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
authorJuergen Kahrs <Juergen.Kahrs@googlemail.com>2014-06-24 13:18:33 +0200
committerJuergen Kahrs <Juergen.Kahrs@googlemail.com>2014-06-24 13:18:33 +0200
commitf1245d04a9f076773c60499b468f44ed9c91b59b (patch)
tree2b49234400150bfaac7ebf8c017562300edc7471 /regcomp.c
parentee9707cc44eea3ca64cb71666ac3e8ed26a3bb7f (diff)
parent78ded8ee8f11a321c96417e7d02dac2f5723a221 (diff)
downloadegawk-f1245d04a9f076773c60499b468f44ed9c91b59b.tar.gz
egawk-f1245d04a9f076773c60499b468f44ed9c91b59b.tar.bz2
egawk-f1245d04a9f076773c60499b468f44ed9c91b59b.zip
Merge remote-tracking branch 'origin/master' into cmake
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index f3c4587d..a62364c9 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2476,14 +2476,22 @@ 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)
{
- tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
- if (BE (*err != REG_NOERROR && tree == NULL, 0))
- return NULL;
+ 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)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
+ tree = dup_tree;
/* In BRE consecutive duplications are not allowed. */
if ((syntax & RE_CONTEXT_INVALID_DUP)
&& (token->type == OP_DUP_ASTERISK
|| token->type == OP_OPEN_DUP_NUM))
{
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
*err = REG_BADRPT;
return NULL;
}
@@ -3128,8 +3136,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 */
{
- re_free (sbcset);
#ifdef RE_ENABLE_I18N
+ re_free (sbcset);
re_free (mbcset);
#endif
*err = REG_ESPACE;