dcavalca / rpms / grub2

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