fts_close calls free(sp), the ISSET(FTS_NOCHDIR) which is a macro that

references sp. The free needs to follow ISSET

PR:		7148
Reviewed by:	phk
Submitted by:	Ken Mayer <kmayer@freegate.com>
This commit is contained in:
Poul-Henning Kamp 1998-07-03 08:21:05 +00:00
parent e25169f239
commit 8a507b98ab
2 changed files with 8 additions and 6 deletions

View File

@ -241,14 +241,15 @@ 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) {
/* Free up the stream pointer. */
free(sp);
errno = saved_errno;
return (-1);
}
/* Free up the stream pointer. */
free(sp);
return (0);
}

View File

@ -241,14 +241,15 @@ 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) {
/* Free up the stream pointer. */
free(sp);
errno = saved_errno;
return (-1);
}
/* Free up the stream pointer. */
free(sp);
return (0);
}