All of lore.kernel.org
 help / color / mirror / Atom feed
* memory leak in normal/command.c(grub_command_find)?
@ 2005-11-14  4:03 Mike Small
  2005-11-18 10:51 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Small @ 2005-11-14  4:03 UTC (permalink / raw)
  To: grub-devel

Hello,

It looks to me like there is a memory leak in grub_command_find:

grub_command_t
grub_command_find (char *cmdline)
{
...

again:
  
  for (cmd = grub_command_list; cmd; cmd = cmd->next)
    if (grub_strcmp (cmdline, cmd->name) == 0)
      break;

  if (! cmd)
    grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%s'", cmdline);
  else if (cmd->flags & GRUB_COMMAND_FLAG_NOT_LOADED)
    {
      /* Automatically load the command.  */
      if (count == 0)
	{
	  grub_dl_t mod;
	  char *module_name;

	  module_name = grub_strdup (cmd->module_name);
	  if (module_name)
	    {
	      mod = grub_dl_load (module_name);
	      if (mod)
		{
		  grub_dl_ref (mod);
		  count++;
  		  goto again;
		}

	      grub_free (module_name);  <<<< never reached because of goto
	    }
	}
...



-- 
Mike Small
smallm@panix.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: memory leak in normal/command.c(grub_command_find)?
  2005-11-14  4:03 memory leak in normal/command.c(grub_command_find)? Mike Small
@ 2005-11-18 10:51 ` Yoshinori K. Okuji
  0 siblings, 0 replies; 2+ messages in thread
From: Yoshinori K. Okuji @ 2005-11-18 10:51 UTC (permalink / raw)
  To: The development of GRUB 2

On Monday 14 November 2005 05:03 am, Mike Small wrote:
> It looks to me like there is a memory leak in grub_command_find:

You are right. Thank you.

Okuji



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-18 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-14  4:03 memory leak in normal/command.c(grub_command_find)? Mike Small
2005-11-18 10:51 ` Yoshinori K. Okuji

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.