efi: fix memory leak in variable handling
This commit is contained in:
parent
d0d90d7848
commit
81ca24a59c
1 changed files with 6 additions and 2 deletions
|
@ -206,6 +206,7 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
|
||||||
| GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
|
| GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
|
||||||
| GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
|
| GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
|
||||||
datasize, data);
|
datasize, data);
|
||||||
|
grub_free (var16);
|
||||||
if (status == GRUB_EFI_SUCCESS)
|
if (status == GRUB_EFI_SUCCESS)
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
@ -237,8 +238,11 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
||||||
|
|
||||||
status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, NULL);
|
status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, NULL);
|
||||||
|
|
||||||
if (!datasize)
|
if (status != GRUB_EFI_SUCCESS || !datasize)
|
||||||
return NULL;
|
{
|
||||||
|
grub_free (var16);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
data = grub_malloc (datasize);
|
data = grub_malloc (datasize);
|
||||||
if (!data)
|
if (!data)
|
||||||
|
|
Loading…
Reference in a new issue