sbkeysync: fix invalid free in keystore_read_entry
We want to free path, not ke. We can also unify the error path. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
parent
41c741fe13
commit
b4773c902a
1 changed files with 3 additions and 5 deletions
|
@ -544,17 +544,15 @@ static int check_efivars_mount(const char *mountpoint)
|
||||||
static int keystore_entry_read(struct fs_keystore_entry *ke)
|
static int keystore_entry_read(struct fs_keystore_entry *ke)
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
|
int rc;
|
||||||
|
|
||||||
path = talloc_asprintf(ke, "%s/%s", ke->root, ke->name);
|
path = talloc_asprintf(ke, "%s/%s", ke->root, ke->name);
|
||||||
|
|
||||||
if (fileio_read_file(ke, path, &ke->data, &ke->len)) {
|
rc = fileio_read_file(ke, path, &ke->data, &ke->len);
|
||||||
talloc_free(ke);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
talloc_free(path);
|
talloc_free(path);
|
||||||
|
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool keystore_contains_file(struct fs_keystore *keystore,
|
static bool keystore_contains_file(struct fs_keystore *keystore,
|
||||||
|
|
Loading…
Reference in a new issue