Skip to content

Commit

Permalink
Fix resource leak in Fts_children()
Browse files Browse the repository at this point in the history
This function is not used anywhere within our codebase (and neither is
it part of the public API) so it's basically a no-op... Still, rather
than yanking it completely, let's just silence the Coverity error here.

Found by Coverity.
  • Loading branch information
dmnks authored and ffesti committed Jun 28, 2021
1 parent 5baf73f commit 3c8b01b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion misc/fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,10 @@ Fts_children(FTS * sp, int 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);
}
Expand Down

0 comments on commit 3c8b01b

Please sign in to comment.