This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for fts.c


> 
> > @@ -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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]