39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
|
From 49bf3faa106498e151306fc780c63194a14751e3 Mon Sep 17 00:00:00 2001
|
||
|
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||
|
Date: Fri, 26 Jun 2020 10:51:43 -0400
|
||
|
Subject: [PATCH] multiboot2: Fix memory leak if
|
||
|
grub_create_loader_cmdline() fails
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Fixes: CID 292468
|
||
|
|
||
|
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||
|
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||
|
---
|
||
|
grub-core/loader/multiboot_mbi2.c | 6 +++++-
|
||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
||
|
index 53da78615..0efc66062 100644
|
||
|
--- a/grub-core/loader/multiboot_mbi2.c
|
||
|
+++ b/grub-core/loader/multiboot_mbi2.c
|
||
|
@@ -1070,7 +1070,11 @@ grub_multiboot2_add_module (grub_addr_t start, grub_size_t size,
|
||
|
err = grub_create_loader_cmdline (argc, argv, newmod->cmdline,
|
||
|
newmod->cmdline_size, GRUB_VERIFY_MODULE_CMDLINE);
|
||
|
if (err)
|
||
|
- return err;
|
||
|
+ {
|
||
|
+ grub_free (newmod->cmdline);
|
||
|
+ grub_free (newmod);
|
||
|
+ return err;
|
||
|
+ }
|
||
|
|
||
|
if (modules_last)
|
||
|
modules_last->next = newmod;
|
||
|
--
|
||
|
2.26.2
|
||
|
|