mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-27 22:32:31 +02:00
evmctl: fix memory leak in get_password
The variable "password" is not freed nor returned in case get_password() succeeds. Return it instead of the intermediary variable "pwd". Issue found by Coverity scan tool. src/evmctl.c:2565: leaked_storage: Variable "password" going out of scope leaks the storage it points to. Signed-off-by: Bruno Meneguele <bmeneg@redhat.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
b1818c1113
commit
fa2ba9a6e9
@ -2629,7 +2629,12 @@ static char *get_password(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pwd;
|
||||
if (pwd == NULL) {
|
||||
free(password);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
Loading…
x
Reference in New Issue
Block a user