mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-27 22:32:31 +02:00
ima-evm-utils: Fix memory leak in init_public_keys
strdup'ed string should be freed. Found with ASan. Signed-off-by: Vitaly Chikunov <vt@altlinux.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
faea7ca2b1
commit
bb35e696df
@ -421,11 +421,12 @@ static EVP_PKEY *find_keyid(uint32_t keyid)
|
||||
void init_public_keys(const char *keyfiles)
|
||||
{
|
||||
struct public_key_entry *entry;
|
||||
char *tmp_keyfiles;
|
||||
char *tmp_keyfiles, *keyfiles_free;
|
||||
char *keyfile;
|
||||
int i = 1;
|
||||
|
||||
tmp_keyfiles = strdup(keyfiles);
|
||||
keyfiles_free = tmp_keyfiles;
|
||||
|
||||
while ((keyfile = strsep(&tmp_keyfiles, ", \t")) != NULL) {
|
||||
if (!keyfile)
|
||||
@ -452,6 +453,7 @@ void init_public_keys(const char *keyfiles)
|
||||
entry->next = public_keys;
|
||||
public_keys = entry;
|
||||
}
|
||||
free(keyfiles_free);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user