about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-10-12 09:00:33 -0400
committerPetr Baudis <pasky@suse.cz>2010-11-09 02:38:44 +0100
commit1f260d0fdc83ea4f9213ca57d0dbfed1bcd2e52f (patch)
treed88ee41fec03f8a6dc43ce412d411eca4eeabae5
parent153501dc10cd4e5c9aa5084c1526fff7448b8854 (diff)
downloadglibc-1f260d0fdc83ea4f9213ca57d0dbfed1bcd2e52f.tar.gz
glibc-1f260d0fdc83ea4f9213ca57d0dbfed1bcd2e52f.tar.xz
glibc-1f260d0fdc83ea4f9213ca57d0dbfed1bcd2e52f.zip
One more regex memory leak fixed.
(cherry picked from commit b833d51fbbf78b38c6ff68074c22d3fe3ddd0ce3)
-rw-r--r--ChangeLog6
-rw-r--r--posix/bug-regex31.input1
-rw-r--r--posix/regcomp.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ee288b0460..68d62d2866 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-12  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #12078]
+	* posix/regcomp.c (parse_branch): One more memory leak plugged.
+	* posix/bug-regex31.input: Add test case.
+
 2010-10-11  Ulrich Drepper  <drepper@gmail.com>
 
 	* posix/bug-regex31.c: Rewrite to run multiple tests from stdin.
diff --git a/posix/bug-regex31.input b/posix/bug-regex31.input
index eea961ccf5..3d1f531f4e 100644
--- a/posix/bug-regex31.input
+++ b/posix/bug-regex31.input
@@ -1,3 +1,4 @@
+[[][
 ([0]
 ([0]a
 ([0]([0])
diff --git a/posix/regcomp.c b/posix/regcomp.c
index c6de044050..c48020dcb9 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2154,6 +2154,8 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
       exp = parse_expression (regexp, preg, token, syntax, nest, err);
       if (BE (*err != REG_NOERROR && exp == NULL, 0))
 	{
+	  if (tree != NULL)
+	    postorder (tree, free_tree, NULL);
 	  return NULL;
 	}
       if (tree != NULL && exp != NULL)