Fix memory leaks by replacing realloc(3) with reallocf(3)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
parent
82480995b4
commit
0ec157d579
@ -1200,9 +1200,9 @@ int main (int argc, char **argv)
|
|||||||
#ifdef USE_PAM
|
#ifdef USE_PAM
|
||||||
/* keep the list of user/password for later update by PAM */
|
/* keep the list of user/password for later update by PAM */
|
||||||
nusers++;
|
nusers++;
|
||||||
lines = realloc (lines, sizeof (lines[0]) * nusers);
|
lines = reallocf (lines, sizeof (lines[0]) * nusers);
|
||||||
usernames = realloc (usernames, sizeof (usernames[0]) * nusers);
|
usernames = reallocf (usernames, sizeof (usernames[0]) * nusers);
|
||||||
passwords = realloc (passwords, sizeof (passwords[0]) * nusers);
|
passwords = reallocf (passwords, sizeof (passwords[0]) * nusers);
|
||||||
lines[nusers-1] = line;
|
lines[nusers-1] = line;
|
||||||
usernames[nusers-1] = strdup (fields[0]);
|
usernames[nusers-1] = strdup (fields[0]);
|
||||||
passwords[nusers-1] = strdup (fields[1]);
|
passwords[nusers-1] = strdup (fields[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user