dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0217-chainloader-fix-resoource-leak.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
27a4da
From: Andrei Borzenkov <arvidjaar@gmail.com>
27a4da
Date: Fri, 26 Jun 2015 09:25:30 +0300
28f7f8
Subject: [PATCH] chainloader: fix resoource leak
27a4da
27a4da
Found by: Coverity scan.
27a4da
CID: 96651
27a4da
---
27a4da
 grub-core/loader/efi/chainloader.c | 6 +++---
27a4da
 1 file changed, 3 insertions(+), 3 deletions(-)
27a4da
27a4da
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
28f7f8
index ec23cf4ed66..522a716e37d 100644
27a4da
--- a/grub-core/loader/efi/chainloader.c
27a4da
+++ b/grub-core/loader/efi/chainloader.c
27a4da
@@ -350,9 +350,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
27a4da
     }
27a4da
   loaded_image->device_handle = dev_handle;
27a4da
 
27a4da
-  grub_file_close (file);
27a4da
-  file = NULL;
27a4da
-
27a4da
   if (argc > 1)
27a4da
     {
27a4da
       int i, len;
27a4da
@@ -382,6 +379,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
27a4da
       loaded_image->load_options_size = len;
27a4da
     }
27a4da
 
27a4da
+  grub_file_close (file);
27a4da
+  grub_device_close (dev);
27a4da
+
27a4da
   grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
27a4da
   return 0;
27a4da