From eb33e61b31902a5493468895aaf83fa0b4f5f59d Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sat, 20 Jun 2015 23:38:18 +0300 Subject: [PATCH] multiboot: fix memory leak Found by: Coverity scan. CID: 96684 --- grub-core/loader/multiboot_elfxx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c index 9dc21a1ba..6a220bdc1 100644 --- a/grub-core/loader/multiboot_elfxx.c +++ b/grub-core/loader/multiboot_elfxx.c @@ -169,7 +169,10 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, const char *filename, voi return grub_errno; if (grub_file_seek (file, ehdr->e_shoff) == (grub_off_t) -1) - return grub_errno; + { + grub_free (shdr); + return grub_errno; + } if (grub_file_read (file, shdr, ehdr->e_shnum * ehdr->e_shentsize) != (grub_ssize_t) ehdr->e_shnum * ehdr->e_shentsize)