Use reallocarray(3) instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
45c0003e53
commit
1aa22c1467
@ -127,15 +127,14 @@ void addenv (const char *string, /*@null@*/const char *value)
|
|||||||
|
|
||||||
if ((newenvc & (NEWENVP_STEP - 1)) == 0) {
|
if ((newenvc & (NEWENVP_STEP - 1)) == 0) {
|
||||||
char **__newenvp;
|
char **__newenvp;
|
||||||
size_t newsize;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the resize operation succeeds we can
|
* If the resize operation succeeds we can
|
||||||
* happily go on, else print a message.
|
* happily go on, else print a message.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
newsize = (newenvc + NEWENVP_STEP) * sizeof (char *);
|
__newenvp = (char **) reallocarray (newenvp, newenvc + NEWENVP_STEP,
|
||||||
__newenvp = (char **) realloc (newenvp, newsize);
|
sizeof (char *));
|
||||||
|
|
||||||
if (NULL != __newenvp) {
|
if (NULL != __newenvp) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user