[hackers] [sbase] ed: Use reallocarray || Michael Forney
commit a8dc42e6b5aa0926ec3bea32dd17bd319d0f3b99
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Tue Dec 31 13:41:38 2019 -0800
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Tue Dec 31 13:41:38 2019 -0800
ed: Use reallocarray
diff --git a/ed.c b/ed.c
index b844e86..e998e81 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -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;
Received on Tue Dec 31 2019 - 22:47:28 CET
This archive was generated by hypermail 2.3.0
: Tue Dec 31 2019 - 22:48:27 CET