From 9d52489bd3756b3c472850e1ba07227a07b8d38e Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Mon, 15 Jul 2019 23:05:51 +0300 Subject: [PATCH] ima-evm-utils: Fix memory leak in get_password Free allocated password buffer when returning NULL. Fixes: CID 229894 (partially). Signed-off-by: Vitaly Chikunov Signed-off-by: Mimi Zohar --- src/evmctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/evmctl.c b/src/evmctl.c index 04dc546..f15056b 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -1841,6 +1841,7 @@ static char *get_password(void) if (tcsetattr(fileno(stdin), TCSANOW, &tmp_flags) != 0) { perror("tcsetattr"); + free(password); return NULL; } @@ -1850,6 +1851,7 @@ static char *get_password(void) /* restore terminal */ if (tcsetattr(fileno(stdin), TCSANOW, &flags) != 0) { perror("tcsetattr"); + free(password); return NULL; }