From: Sam Ravnborg <sam@ravnborg.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Dan McGee <dan@archlinux.org>, dash@vger.kernel.org
Subject: Re: dash regression against klibc
Date: Fri, 2 May 2008 12:30:49 +0200 [thread overview]
Message-ID: <20080502103049.GA20741@uranus.ravnborg.org> (raw)
In-Reply-To: <20080502095340.GA17407@gondor.apana.org.au>
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
next prev parent reply other threads:[~2008-05-02 10:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-01 17:25 dash regression against klibc Dan McGee
2008-05-02 5:25 ` Herbert Xu
2008-05-02 6:23 ` Herbert Xu
2008-05-02 7:50 ` Sam Ravnborg
2008-05-02 9:53 ` Herbert Xu
2008-05-02 10:30 ` Sam Ravnborg [this message]
2008-05-03 1:08 ` Dan McGee
2008-05-03 2:21 ` Herbert Xu
2008-05-03 6:06 ` H. Peter Anvin
2008-05-03 6:13 ` Herbert Xu
2008-05-03 6:16 ` Dan McGee
2008-05-03 6:19 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080502103049.GA20741@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=dan@archlinux.org \
--cc=dash@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox