dcavalca / rpms / grub2

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