about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-10-12 09:00:33 -0400
committerAndreas Schwab <schwab@redhat.com>2010-12-01 15:35:15 +0100
commit5fc312669aba0b493d79989ddd64b425f43d3c88 (patch)
treeab7d97f84faa6f97e78996d9d27b5e0cf3001ec6 /posix
parent12ba2c9c8c0f134056fc5aae60682aac2510fe13 (diff)
downloadglibc-5fc312669aba0b493d79989ddd64b425f43d3c88.tar.gz
glibc-5fc312669aba0b493d79989ddd64b425f43d3c88.tar.xz
glibc-5fc312669aba0b493d79989ddd64b425f43d3c88.zip
One more regex memory leak fixed.
(cherry picked from commit b833d51fbbf78b38c6ff68074c22d3fe3ddd0ce3)
Diffstat (limited to 'posix')
-rw-r--r--posix/bug-regex31.input1
-rw-r--r--posix/regcomp.c2
2 files changed, 3 insertions, 0 deletions
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 4ee7b90ace..b238c08225 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2160,6 +2160,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)