commit a8dc42e6b5aa0926ec3bea32dd17bd319d0f3b99
parent d4634f6740015fc630cca483ce38d6d0b58930b1
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 31 Dec 2019 13:41:38 -0800
ed: Use reallocarray
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -204,7 +204,7 @@ makeline(char *s, int *off)
if (lastidx >= idxsize) {
lp = NULL;
if (idxsize <= SIZE_MAX - NUMLINES)
- lp = realloc(zero, (idxsize + NUMLINES) * sizeof(*lp));
+ lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));
if (!lp)
error("out of memory");
idxsize += NUMLINES;