mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-21 14:53:53 +03:00
Fix memory leak in regexp compiler (BZ #17069)
This commit is contained in:
@@ -2415,14 +2415,21 @@ 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user