Add support for --with-system-gdbinit

Daniel Jacobowitz drow@false.org
Fri Jan 23 17:42:00 GMT 2009


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



More information about the Gdb-patches mailing list