summaryrefslogtreecommitdiff
path: root/lib/regex_internal.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-04-08 17:02:21 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-04-08 17:33:16 -0700
commit0b16e4e1f1b9e6de16aa613b1b363d76b1023766 (patch)
tree74fd7a86a1413b54f624f75254de63abf220fa90 /lib/regex_internal.c
parent68bc1446855c86b96d5bc22f819e63358ab250ac (diff)
downloademacs-0b16e4e1f1b9e6de16aa613b1b363d76b1023766.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib/regex_internal.c')
-rw-r--r--lib/regex_internal.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 3945ee7ecbf..0e6919f3400 100644
--- a/lib/regex_internal.c
+++ b/lib/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;