From c592b8e3daf712a1774a457b9d640fc1ff106e70 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 19 Jan 2010 15:13:16 +0100 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ lib/regex_internal.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 20b6ae2cae..c3cb30046b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-01-28 Jim Meyering + 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. diff --git a/lib/regex_internal.c b/lib/regex_internal.c index a116106708..378b767d82 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -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; } -- 2.30.2