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

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