memory leak fix in grub_script_execute_cmdline

This commit is contained in:
BVK Chaitanya 2010-05-19 10:25:41 +05:30
parent dada803720
commit 0003008a58
3 changed files with 8 additions and 6 deletions

View file

@ -66,7 +66,7 @@ struct grub_script_arg
/* An argument vector. */
struct grub_script_argv
{
int argc;
unsigned argc;
char **args;
};

View file

@ -29,6 +29,7 @@ round_up_exp (unsigned v)
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
if (sizeof (v) > 4)
v |= v >> 32;
@ -41,7 +42,7 @@ round_up_exp (unsigned v)
void
grub_script_argv_free (struct grub_script_argv *argv)
{
int i;
unsigned i;
if (argv->args)
{

View file

@ -77,7 +77,7 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
}
else if (grub_strcmp (name, "*") == 0)
{
int i;
unsigned i;
for (i = 0; ! errors && i < scope->argv.argc; i++)
if (type == GRUB_SCRIPT_ARG_TYPE_VAR)
@ -97,7 +97,7 @@ grub_script_env_get (const char *name, grub_script_arg_type_t type)
}
else if (grub_strcmp (name, "@") == 0)
{
int i;
unsigned i;
for (i = 0; ! errors && i < scope->argv.argc; i++)
{
@ -287,6 +287,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
grub_snprintf (errnobuf, sizeof (errnobuf), "%d", grub_errno);
grub_env_set ("?", errnobuf);
grub_script_argv_free (&argv);
grub_print_error ();
return 0;
@ -353,8 +354,8 @@ grub_script_execute_cmdif (struct grub_script_cmd *cmd)
grub_err_t
grub_script_execute_cmdfor (struct grub_script_cmd *cmd)
{
int i;
int result;
unsigned i;
grub_err_t result;
struct grub_script_argv argv;
struct grub_script_cmdfor *cmdfor = (struct grub_script_cmdfor *) cmd;