regex: do not ignore memory allocation failure
authorJim Meyering <meyering@redhat.com>
Tue, 19 Jan 2010 14:13:16 +0000 (15:13 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 28 Jan 2010 10:57:33 +0000 (11:57 +0100)
* lib/regex_internal.c (create_cd_newstate): Detect
re_node_set_init_copy failure.   Extracted from glibc commit
2da42bc06566bc89785e580fa1ac89b4c9f2a63c.

ChangeLog
lib/regex_internal.c

index 20b6ae2cae14be94a04288fec86de9b60ab33036..c3cb30046bf04cf18adcc62944c02a2fb180f3ab 100644 (file)
--- 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.
index a116106708508c828fff134cb45049418a824f8a..378b767d8228ad7750d27f815a9a37dbd88dfb63 100644 (file)
@@ -1716,7 +1716,9 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
                  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;
            }