grub2/0262-commands-parttool-fix-memory-leak.patch

31 lines
977 B
Diff
Raw Normal View History

From 3db4f05a10e98a4835ddd87f9d1ef9185e8eef84 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Tue, 27 Jan 2015 20:55:25 +0300
Subject: [PATCH 262/506] commands/parttool: fix memory leak.
Found by: Coverity scan.
---
grub-core/commands/parttool.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/parttool.c b/grub-core/commands/parttool.c
index d907694..42c590e 100644
--- a/grub-core/commands/parttool.c
+++ b/grub-core/commands/parttool.c
@@ -282,8 +282,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
break;
}
if (! cur)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
+ {
+ grub_device_close (dev);
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
args[i]);
+ }
ptool = cur;
pargs = (struct grub_parttool_args *)
grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args));
--
2.4.3