1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 06:33:36 +02:00

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 <vt@altlinux.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Vitaly Chikunov 2019-07-15 23:05:51 +03:00 committed by Mimi Zohar
parent 4b7a74cc41
commit 9d52489bd3

View File

@ -1841,6 +1841,7 @@ static char *get_password(void)
if (tcsetattr(fileno(stdin), TCSANOW, &tmp_flags) != 0) { if (tcsetattr(fileno(stdin), TCSANOW, &tmp_flags) != 0) {
perror("tcsetattr"); perror("tcsetattr");
free(password);
return NULL; return NULL;
} }
@ -1850,6 +1851,7 @@ static char *get_password(void)
/* restore terminal */ /* restore terminal */
if (tcsetattr(fileno(stdin), TCSANOW, &flags) != 0) { if (tcsetattr(fileno(stdin), TCSANOW, &flags) != 0) {
perror("tcsetattr"); perror("tcsetattr");
free(password);
return NULL; return NULL;
} }