about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2015-09-23 18:19:34 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-24 02:33:18 -0400
commit4260dfe1ecc43d92d1e6d30daa0f22bd746d1740 (patch)
treed9bd71ea879cbf0acd08ae616cd682d663c88f0a
parentb61df2294f662540786f2558f691eba7447ff5ba (diff)
downloadmusl-4260dfe1ecc43d92d1e6d30daa0f22bd746d1740.tar.gz
musl-4260dfe1ecc43d92d1e6d30daa0f22bd746d1740.tar.xz
musl-4260dfe1ecc43d92d1e6d30daa0f22bd746d1740.zip
regcomp: propagate allocation failures
The error code of an allocating function was not checked in tre_add_tag.
-rw-r--r--src/regex/regcomp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 978dd87f..330de467 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -1584,7 +1584,8 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree,
 		  {
 		    status = tre_add_tag_right(mem, left, tag_left);
 		    tnfa->tag_directions[tag_left] = TRE_TAG_MAXIMIZE;
-		    status = tre_add_tag_right(mem, right, tag_right);
+		    if (status == REG_OK)
+		      status = tre_add_tag_right(mem, right, tag_right);
 		    tnfa->tag_directions[tag_right] = TRE_TAG_MAXIMIZE;
 		  }
 		num_tags += 2;