All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Small <smallm@panix.com>
To: grub-devel@gnu.org
Subject: memory leak in normal/command.c(grub_command_find)?
Date: Sun, 13 Nov 2005 23:03:02 -0500	[thread overview]
Message-ID: <20051114040302.GA3883@panix.com> (raw)

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



             reply	other threads:[~2005-11-14  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-14  4:03 Mike Small [this message]
2005-11-18 10:51 ` memory leak in normal/command.c(grub_command_find)? Yoshinori K. Okuji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051114040302.GA3883@panix.com \
    --to=smallm@panix.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.