commit d34545f0a7b228ae402bb2091c7b15548aee3e20
parent df7168f12afd06bf384775d70d2f8b4834c322bc
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 18 Sep 2022 14:02:20 +0200
fs::readdir: fix dirfd leak
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/fs/util.ha b/fs/util.ha
@@ -88,6 +88,7 @@ export fn issocket(mode: mode) bool = mode & IFMT == mode::SOCK;
// with [[dirents_free]].
export fn readdir(fs: *fs, path: str) ([]dirent | error) = {
let i = iter(fs, path)?;
+ defer finish(i);
let ents: []dirent = [];
for (true) {
match (next(i)) {