From 6739849e21c5bfd849b0c4029c2950902e7656af Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 25 Mar 2022 14:00:55 +0300 Subject: Sync support files from GNULIB. --- support/regex_internal.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'support/regex_internal.c') diff --git a/support/regex_internal.c b/support/regex_internal.c index 3945ee7e..0e6919f3 100644 --- a/support/regex_internal.c +++ b/support/regex_internal.c @@ -1396,24 +1396,22 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token) if (__glibc_unlikely (new_nodes == NULL)) return -1; dfa->nodes = new_nodes; + dfa->nodes_alloc = new_nodes_alloc; new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc); + if (new_nexts != NULL) + dfa->nexts = new_nexts; new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc); + if (new_indices != NULL) + dfa->org_indices = new_indices; new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc); + if (new_edests != NULL) + dfa->edests = new_edests; new_eclosures = re_realloc (dfa->eclosures, re_node_set, new_nodes_alloc); + if (new_eclosures != NULL) + dfa->eclosures = new_eclosures; if (__glibc_unlikely (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL)) - { - re_free (new_nexts); - re_free (new_indices); - re_free (new_edests); - re_free (new_eclosures); - return -1; - } - dfa->nexts = new_nexts; - dfa->org_indices = new_indices; - dfa->edests = new_edests; - dfa->eclosures = new_eclosures; - dfa->nodes_alloc = new_nodes_alloc; + return -1; } dfa->nodes[dfa->nodes_len] = token; dfa->nodes[dfa->nodes_len].constraint = 0; -- cgit v1.2.3