On mar., 2011-01-18 at 11:32 +0100, Arjen de Korte wrote: > Citeren Frederic BOHE <[email protected]>: > > > --- 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. -------------------------------------------------------------------------- _______________________________________________ Nut-upsdev mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
