]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix memory leak for some invalid regular expressions.
authorUlrich Drepper <drepper@gmail.com>
Mon, 11 Oct 2010 15:46:22 +0000 (11:46 -0400)
committerAndreas Schwab <schwab@redhat.com>
Wed, 1 Dec 2010 14:35:13 +0000 (15:35 +0100)
(cherry picked from commit a129c80d54ec951567caa8c1b042275422d5f367)

ChangeLog
posix/regcomp.c

index 0d020c83e685d8c5f97a7bd9b8af923d1731d374..85df1448927e91ea4ff51a6c292613a2dc82642c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +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.
+
 2010-10-11  Ulrich Drepper  <drepper@gmail.com>
 
        [BZ #12093]
index 03ab12390713452f9ebc716340046b5224ddddf0..9f5ca2cd0e6a6fc6e783eec41f39b6202d0b231d 100644 (file)
@@ -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;
     }
@@ -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;
     }