This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add support for --with-system-gdbinit


On Wed, Jan 21, 2009 at 11:53:48AM +0100, Jerome Guitton wrote:
> +  if (!initialized)
> +    {
> +      struct stat homebuf, cwdbuf, s;
> +      char *homedir, *relocated_sysgdbinit;
> +
> +      if (stat (SYSTEM_GDBINIT, &s) == 0)
> +	sysgdbinit = SYSTEM_GDBINIT;

What, if anything, does SYSTEM_GDBINIT get defined to when GDB is
configured with no special options?

> +      if (homedir)
> +	{
> +	  homeinit = xstrprintf ("%s/%s", homedir, gdbinit);
> +	  if (stat (homeinit, &homebuf) != 0)
> +	    homeinit = NULL;
> +
> +	  stat (homeinit, &homebuf);
> +	}

You've got a bunch of memory leaks in this function; this is one of
them.  homeinit is not freed if it does not exist.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]