multiboot2: Fix memory leak if grub_create_loader_cmdline() fails
Fixes: CID 292468 Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
d17770857e
commit
f8ad7a3dd8
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue