From 08ae7af111aaf8eb399b6ca2d473f4fc0c353dc6 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 17 Jan 2024 17:08:50 +0100 Subject: [PATCH] src/sulogin.c: Remove 'static' from local variable, but keep initialization We don't need 'static', because it's in main(), which is only called once. However, we will need initialization as if it were 'static', so use ={} to initialize it. This will allow freeing the pointers before they have been allocated. Cc: Samanta Navarro Suggested-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- src/sulogin.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sulogin.c b/src/sulogin.c index aa588c3d..ab2dcf94 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -55,17 +55,19 @@ static void catch_signals (unused int sig) _exit (1); } -/*ARGSUSED*/ int main (int argc, char **argv) + +/*ARGSUSED*/ int +main(int argc, char **argv) { int err = 0; char pass[BUFSIZ]; char **envp = environ; TERMIO termio; + struct passwd pwent = {}; #ifndef USE_PAM const char *env; #endif - static struct passwd pwent; tcgetattr (0, &termio); termio.c_iflag |= (ICRNL | IXON);