changeset 12834:baafee3ff85b

regex: do not ignore memory allocation failure * lib/regex_internal.c (create_cd_newstate): Detect re_node_set_init_copy failure. Extracted from glibc commit 2da42bc06566bc89785e580fa1ac89b4c9f2a63c.
author Jim Meyering <meyering@redhat.com>
date Tue, 19 Jan 2010 15:13:16 +0100
parents f6972e309c30
children 7217c0b5595d
files ChangeLog lib/regex_internal.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-01-28  Jim Meyering  <meyering@redhat.com>
 
+	regex: do not ignore memory allocation failure
+	* lib/regex_internal.c (create_cd_newstate): Detect
+	re_node_set_init_copy failure.   Extracted from glibc commit
+	2da42bc06566bc89785e580fa1ac89b4c9f2a63c.
+
 	regex: sync more white-space changes from libc
 	* lib/regex_internal.c: White-space only changes.
 	* lib/regexec.c: Likewise.
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1716,7 +1716,9 @@
 		  free_state (newstate);
 		  return NULL;
 		}
-	      re_node_set_init_copy (newstate->entrance_nodes, nodes);
+	      if (re_node_set_init_copy (newstate->entrance_nodes, nodes)
+		  != REG_NOERROR)
+		return NULL;
 	      nctx_nodes = 0;
 	      newstate->has_constraint = 1;
 	    }