Date: Wed, 1 Jun 2016 17:37:16 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301150 - stable/10/lib/libc/gen Message-ID: <201606011737.u51HbGuI056269@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Wed Jun 1 17:37:16 2016 New Revision: 301150 URL: https://svnweb.freebsd.org/changeset/base/301150 Log: MFC r300660 Fix 1016718 Resource leak. Don't leak a file descriptor if fchdir() fails. Reported by: Coverity CID: 1016718 Modified: stable/10/lib/libc/gen/fts-compat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/fts-compat.c ============================================================================== --- stable/10/lib/libc/gen/fts-compat.c Wed Jun 1 17:35:03 2016 (r301149) +++ stable/10/lib/libc/gen/fts-compat.c Wed Jun 1 17:37:16 2016 (r301150) @@ -586,8 +586,10 @@ __fts_children_44bsd(sp, instr) if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606011737.u51HbGuI056269>