Blame SOURCES/0235-efi-fix-memory-leak-in-variable-handling.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Ignat Korchagin <ignat@cloudflare.com>
a85e8e
Date: Thu, 23 Jul 2015 21:13:09 +0300
d41074
Subject: [PATCH] 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
d41074
index 453f97a7595..0cd64cdb59e 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)