This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Re: A patch for fts.c
- To: rth@cygnus.com
- Subject: Re: A patch for fts.c
- From: hjl@lucon.org (H.J. Lu)
- Date: Mon, 11 Jan 1999 21:30:14 -0800 (PST)
- Cc: libc-hacker@cygnus.com
>
> > @@ -259,15 +260,18 @@ fts_close(sp)
> > (void)__close(sp->fts_rfd);
> > }
> >
> > - /* Free up the stream pointer. */
> > - free(sp);
> > -
> > /* Set errno and return. */
> > if (!ISSET(FTS_NOCHDIR) && saved_errno) {
> > __set_errno (saved_errno);
> > - return (-1);
> > + retval = -1;
> > }
> > - return (0);
> > + else
> > + retval = 0;
> > +
> > + /* Free up the stream pointer. */
> > + free(sp);
> > +
> > + return retval;
>
> Colour me confused. How does moving the free after the if help?
> It looks to me as if there was no leak to begin with.
>
Can I say stupid BSD? The ISSET macro accesses "sp".
H.J.