grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SECURITY PATCH 14/28] multiboot2: Fix memory leak if grub_create_loader


From: Daniel Kiper
Subject: [SECURITY PATCH 14/28] multiboot2: Fix memory leak if grub_create_loader_cmdline() fails
Date: Wed, 29 Jul 2020 19:00:27 +0200

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Fixes: CID 292468

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.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 18e766c7b..e88c9f488 100644
--- a/grub-core/loader/multiboot_mbi2.c
+++ b/grub-core/loader/multiboot_mbi2.c
@@ -1076,7 +1076,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.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]