ed: Use reallocarray
This commit is contained in:
parent
d4634f6740
commit
a8dc42e6b5
2
ed.c
2
ed.c
|
@ -204,7 +204,7 @@ makeline(char *s, int *off)
|
||||||
if (lastidx >= idxsize) {
|
if (lastidx >= idxsize) {
|
||||||
lp = NULL;
|
lp = NULL;
|
||||||
if (idxsize <= SIZE_MAX - NUMLINES)
|
if (idxsize <= SIZE_MAX - NUMLINES)
|
||||||
lp = realloc(zero, (idxsize + NUMLINES) * sizeof(*lp));
|
lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));
|
||||||
if (!lp)
|
if (!lp)
|
||||||
error("out of memory");
|
error("out of memory");
|
||||||
idxsize += NUMLINES;
|
idxsize += NUMLINES;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user