aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-07-12 23:20:39 -0700
committerArnold D. Robbins <arnold@skeeve.com>2014-07-12 23:20:39 -0700
commitde3372f0d98c7137823e7d5630d03429bb77d1f2 (patch)
tree389fa3f5f107b3ca1178e6d7a65e66ff3644e29c /regcomp.c
parentebb6772e9eabeb81e3cc9305a6bec7adf7aad450 (diff)
parentdf2eaea6a92c7d89d604d0a4e885d064678ce3ed (diff)
downloadegawk-de3372f0d98c7137823e7d5630d03429bb77d1f2.tar.gz
egawk-de3372f0d98c7137823e7d5630d03429bb77d1f2.tar.bz2
egawk-de3372f0d98c7137823e7d5630d03429bb77d1f2.zip
Merge branch 'master' into comment
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index 776b7134..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;
}