diff options
author | phk <phk@FreeBSD.org> | 1998-07-03 08:21:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-07-03 08:21:05 +0000 |
commit | 78b02c367e739ac72c94e70c7df9a3e45ab4a36f (patch) | |
tree | 75d8245ef9e1d47b18bea91f8a092db9257747a8 /lib/libc | |
parent | 4795d888ab00ba1c25a6722f722ff840ee6ce8a6 (diff) | |
download | FreeBSD-src-78b02c367e739ac72c94e70c7df9a3e45ab4a36f.zip FreeBSD-src-78b02c367e739ac72c94e70c7df9a3e45ab4a36f.tar.gz |
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>
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/fts-compat.c | 7 | ||||
-rw-r--r-- | lib/libc/gen/fts.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c index 73832e5..02cad6c 100644 --- a/lib/libc/gen/fts-compat.c +++ b/lib/libc/gen/fts-compat.c @@ -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); } diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 73832e5..02cad6c 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -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); } |