From 0ec157d579931cfec1cc8439288ed17adf19da5d Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 2 Feb 2023 00:59:55 +0100 Subject: [PATCH] Fix memory leaks by replacing realloc(3) with reallocf(3) Signed-off-by: Alejandro Colomar --- src/newusers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/newusers.c b/src/newusers.c index 22db1e9a..5fd83d6e 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -1200,9 +1200,9 @@ int main (int argc, char **argv) #ifdef USE_PAM /* keep the list of user/password for later update by PAM */ nusers++; - lines = realloc (lines, sizeof (lines[0]) * nusers); - usernames = realloc (usernames, sizeof (usernames[0]) * nusers); - passwords = realloc (passwords, sizeof (passwords[0]) * nusers); + lines = reallocf (lines, sizeof (lines[0]) * nusers); + usernames = reallocf (usernames, sizeof (usernames[0]) * nusers); + passwords = reallocf (passwords, sizeof (passwords[0]) * nusers); lines[nusers-1] = line; usernames[nusers-1] = strdup (fields[0]); passwords[nusers-1] = strdup (fields[1]);