about summary refs log tree commit diff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2014-06-20 12:41:27 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2014-06-20 14:03:40 +0200
commitaa6ec754f3b4b1df81d186480c534b6486a1e6ee (patch)
treef46a9bdaa0362bdee62d66054fb634f444227188 /posix/regcomp.c
parent7892406e3591be24e64c12dbf7aa8ef5352d0dbc (diff)
downloadglibc-aa6ec754f3b4b1df81d186480c534b6486a1e6ee.tar.gz
glibc-aa6ec754f3b4b1df81d186480c534b6486a1e6ee.tar.xz
glibc-aa6ec754f3b4b1df81d186480c534b6486a1e6ee.zip
Fix another memory leak in regexp compiler (BZ #17069)
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index a5020be192..076eca3e7c 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -2154,7 +2154,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
 	{
 	  branch = parse_branch (regexp, preg, token, syntax, nest, err);
 	  if (BE (*err != REG_NOERROR && branch == NULL, 0))
-	    return NULL;
+	    {
+	      if (tree != NULL)
+		postorder (tree, free_tree, NULL);
+	      return NULL;
+	    }
 	}
       else
 	branch = NULL;