diff options
author | das <das@FreeBSD.org> | 2009-03-04 03:30:21 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2009-03-04 03:30:21 +0000 |
commit | 9dd8da86ee4466eb7e0035d0d1b20bd5d10bac32 (patch) | |
tree | 0ce65527bc2f876297ceedbc49c2270d6beb0380 /lib/libc/gen | |
parent | 24af7b630b13d91614dd9783bce4b45606128e57 (diff) | |
download | FreeBSD-src-9dd8da86ee4466eb7e0035d0d1b20bd5d10bac32.zip FreeBSD-src-9dd8da86ee4466eb7e0035d0d1b20bd5d10bac32.tar.gz |
Fix a file descriptor leak in fts_child().
Obtained from: NetBSD
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/fts.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index ced205b..41443c5 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -570,8 +570,10 @@ fts_children(sp, instr) if ((fd = _open(".", O_RDONLY, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); - if (fchdir(fd)) + if (fchdir(fd)) { + (void)_close(fd); return (NULL); + } (void)_close(fd); return (sp->fts_child); } |