aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/aho-corasick/acism_create.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/aho-corasick/acism_create.c b/contrib/aho-corasick/acism_create.c
index b1d9b51e3..a6d007fd7 100644
--- a/contrib/aho-corasick/acism_create.c
+++ b/contrib/aho-corasick/acism_create.c
@@ -323,9 +323,15 @@ interleave(TNODE *troot, int nnodes, int nsyms, TNODE **v1, TNODE **v2)
if (last_trans < last) {
last_trans = last;
if (last + nsyms >= usev_size) {
- usev = realloc(usev, usev_size << 1);
- memset(usev + usev_size, 0, usev_size);
- usev_size <<= 1;
+ char *tmp = realloc(usev, usev_size << 1);
+ if (tmp != NULL) {
+ usev = tmp;
+ memset(usev + usev_size, 0, usev_size);
+ usev_size <<= 1;
+ } else {
+ free(usev);
+ /* And handle error */
+ }
}
}
}