Re: dash regression against klibc

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

 



On Fri, May 02, 2008 at 05:53:40PM +0800, Herbert Xu wrote:
> On Fri, May 02, 2008 at 09:50:10AM +0200, Sam Ravnborg wrote:
> >
> > > @@ -251,8 +249,13 @@ inline
> > >  STATIC char *
> > >  getpwd()
> > >  {
> > > +#ifdef _GNU_SOURCE
> > >  	char *dir = getcwd(0, 0);
> > >  	return dir ? dir : nullstr;
> > > +#else
> > > +	char buf[PATH_MAX];
> > > +	return getcwd(buf, sizeof(buf)) ? savestr(buf) : nullstr;
> > > +#endif
> > >  }
> > If this patch is correct then we leak memory in the glic extension case.
> > According to man 3 getcwd the memory is allocated and thus should be freed.
> 
> If we leaked memory in the glibc case then we'd also leak in the
> other one because savestr is dash's version of strdup.  But we
> don't because the caller is responsible for freeing it.

OK, thanks for the explanation!

	Sam
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux