[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] Porting filmgimp-0.1-1.0.4 to GNU/Hurd



On Wed, Aug 14, 2002 at 10:11:04AM +0200, PUYDT Julien wrote:
>  gchar*
>  gimp_gtkrc ()
>  {
> -  static char filename[MAXPATHLEN];
> +  char *filename;

In the way the code seems to be written, you MUST make this static and
do an "if (!filename) {...} return filename;" where ... contains most of the
code.

You are leaking memory at each invocation here.  Alternatively, all callers
of gimp_gtkrc() can free() the returned pointer.

Marcus

> +  int filename_len;
>    char *home_dir;
>  
>    home_dir = getenv ("HOME");
>    if (!home_dir)
>      return NULL;
>  
> +  filename_len = strlen(home_dir) + strlen(GIMPDIR) + 8;
> +  filename = malloc(filename_len);
> +  if (!filename)
> +    return NULL;
>    sprintf (filename, "%s/%s/gtkrc", home_dir, GIMPDIR);
>  
>    return filename;
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/



Reply to: