]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Fix memory leaks by replacing realloc(3) with reallocf(3)
authorAlejandro Colomar <alx@kernel.org>
Wed, 1 Feb 2023 23:59:55 +0000 (00:59 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 4 Feb 2023 04:03:38 +0000 (22:03 -0600)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/newusers.c

index 22db1e9aa9b460a558d9b932fe042f416e1c51f7..5fd83d6ed3ed006213aebd2ad4fa9762ac9d3830 100644 (file)
@@ -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]);