]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
chainloader: fix resoource leak
authorAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 26 Jun 2015 06:25:30 +0000 (09:25 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 26 Jun 2015 06:25:30 +0000 (09:25 +0300)
Found by: Coverity scan.
CID: 96651

grub-core/loader/efi/chainloader.c

index ec23cf4ed66fe2cc624c801af1e8ee36a2101330..522a716e37dedcaf435fb84acd6c830705d861f8 100644 (file)
@@ -350,9 +350,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
     }
   loaded_image->device_handle = dev_handle;
 
-  grub_file_close (file);
-  file = NULL;
-
   if (argc > 1)
     {
       int i, len;
@@ -382,6 +379,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
       loaded_image->load_options_size = len;
     }
 
+  grub_file_close (file);
+  grub_device_close (dev);
+
   grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
   return 0;