[Nut-upsdev] [nut-commits] svn commit r2839 - branches/windows_port/scripts/Windows

Frédéric Bohé fredericbohe at eaton.com
Tue Jan 18 12:43:33 UTC 2011


On mar., 2011-01-18 at 11:32 +0100, Arjen de Korte wrote:
> Citeren Frederic BOHE <fbohe-guest at alioth.debian.org>:
> 
> > --- branches/windows_port/scripts/Windows/wininit.c	Tue Jan 18  
> > 08:57:03 2011	(r2838)
> > +++ branches/windows_port/scripts/Windows/wininit.c	Tue Jan 18  
> > 10:05:01 2011	(r2839)
> > @@ -285,8 +285,11 @@
> >  	char	fn[SMALLBUF];
> >  	FILE	*nutf;
> >  	char	buf[SMALLBUF];
> > +	const char * conf_path;
> >
> > -	snprintf(fn,sizeof(fn),"%s/nut.conf",CONFPATH);
> > +	conf_path = confpath();
> > +	snprintf(fn,sizeof(fn),"%s/nut.conf",conf_path);
> > +	free(conf_path);
> 
> This won't work. You can't free() conf_path here, since it is not  
> dynamically allocated. Use
> 
> 	snprintf(fn, sizeof(fn), "%s/nut.conf", confpath());
> 
> instead.

confpath() does return a dynamically allocated string in WIN32. But if
memory allocation fails it falls back to CONFPATH, in which case there
is indeed a bug. I will fix this.



--------------------------------------------------------------------------



More information about the Nut-upsdev mailing list