Skip to content

Commit

Permalink
Fix memory leak for some invalid regular expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Oct 11, 2010
1 parent b76b818 commit a129c80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2010-10-11 Ulrich Drepper <drepper@gmail.com>

* posix/regcomp.c (parse_bracket_exp): Add missing re_free calls.

[BZ #12078]
* posix/regcomp.c (parse_sub_exp): Free tree data when it is not used.

[BZ #12108]
* stdio-common/psiginfo.c (psiginfo): Don't expext SIGRTMIN..SIGRTMAX
to have entries in sys_siglist.
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Version 2.13
* The following bugs are resolved with this release:

3268, 7066, 10851, 11611, 11640, 11701, 11840, 11856, 11883, 11903, 11904,
11968, 11979, 12005, 12037, 12067, 12077, 12092, 12093, 12107, 12108
11968, 11979, 12005, 12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108

* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark

Expand Down
10 changes: 9 additions & 1 deletion posix/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,11 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
*err = REG_EPAREN;
{
if (tree != NULL)
free_tree (NULL, tree);
*err = REG_EPAREN;
}
if (BE (*err != REG_NOERROR, 0))
return NULL;
}
Expand Down Expand Up @@ -3028,6 +3032,10 @@ 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 (mbcset);
#endif
*err = REG_ESPACE;
return NULL;
}
Expand Down

0 comments on commit a129c80

Please sign in to comment.