ref: 1c424b1b4d5931f2a4b87b6f0f75827bc53ff9d7
parent: 35d462741379ef4616d67ade48058a5e3490f77e
author: Arnold D. Robbins <arnold@skeeve.com>
date: Fri Nov 24 05:49:41 EST 2023
Initialize realloced memory to zero.
--- a/b.c
+++ b/b.c
@@ -602,7 +602,12 @@
gtte *p = (gtte *) realloc(f->gototab[state].entries, new_size * sizeof(gtte));
if (p == NULL)
overflo(__func__);
- f->gototab[state].allocated = new_size;
+
+ // need to initialized the new memory to zero
+ size_t orig_size = f->gototab[state].allocated; // 2nd half of new mem is this size
+ memset(p + orig_size, 0, orig_size * sizeof(gtte)); // clean it out
+
+ f->gototab[state].allocated = new_size; // update gotottab info
f->gototab[state].entries = p;
}
--
⑨