Blame SOURCES/0235-efi-fix-memory-leak-in-variable-handling.patch
|
|
a85e8e |
From b2df313847417e1f9593cdcdccba488393feeff2 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Ignat Korchagin <ignat@cloudflare.com>
|
|
|
a85e8e |
Date: Thu, 23 Jul 2015 21:13:09 +0300
|
|
|
a85e8e |
Subject: [PATCH 235/260] efi: fix memory leak in variable handling
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
a85e8e |
grub-core/kern/efi/efi.c | 8 ++++++--
|
|
|
a85e8e |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
index 453f97a75..0cd64cdb5 100644
|
|
|
a85e8e |
--- a/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
+++ b/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
@@ -211,6 +211,7 @@ grub_efi_set_variable(const char *var, const grub_efi_guid_t *guid,
|
|
|
a85e8e |
| GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS
|
|
|
a85e8e |
| GRUB_EFI_VARIABLE_RUNTIME_ACCESS),
|
|
|
a85e8e |
datasize, data);
|
|
|
a85e8e |
+ grub_free (var16);
|
|
|
a85e8e |
if (status == GRUB_EFI_SUCCESS)
|
|
|
a85e8e |
return GRUB_ERR_NONE;
|
|
|
a85e8e |
|
|
|
a85e8e |
@@ -242,8 +243,11 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
|
|
|
a85e8e |
|
|
|
a85e8e |
status = efi_call_5 (r->get_variable, var16, guid, NULL, &datasize, NULL);
|
|
|
a85e8e |
|
|
|
a85e8e |
- if (!datasize)
|
|
|
a85e8e |
- return NULL;
|
|
|
a85e8e |
+ if (status != GRUB_EFI_SUCCESS || !datasize)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ grub_free (var16);
|
|
|
a85e8e |
+ return NULL;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
|
|
|
a85e8e |
data = grub_malloc (datasize);
|
|
|
a85e8e |
if (!data)
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|