commands/parttool: fix memory leak.

Found by: Coverity scan.
This commit is contained in:
Andrei Borzenkov 2015-01-27 20:55:25 +03:00
parent e871994849
commit 3db4f05a10

View file

@ -282,8 +282,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
break; break;
} }
if (! cur) if (! cur)
{
grub_device_close (dev);
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"), return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
args[i]); args[i]);
}
ptool = cur; ptool = cur;
pargs = (struct grub_parttool_args *) pargs = (struct grub_parttool_args *)
grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args)); grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args));