commit ddaf854a00840adc7e7e5c13f3fae9e4d0ea9a8c
parent 4a9785dd49576b3f1193920f745a9d0bfac242bd
Author: Tom Lebreux <me@tomlebreux.com>
Date: Wed, 1 Jun 2022 08:12:50 -0400
hare::module: fix fd leak when walking directories
Signed-off-by: Tom Lebreux <me@tomlebreux.com>
Diffstat:
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hare/module/scan.ha b/hare/module/scan.ha
@@ -289,6 +289,7 @@ fn scan_directory(
let isdir = inputs[i].0, path = inputs[i].3;
if (isdir) {
let iter = fs::iter(ctx.fs, path)?;
+ defer fs::finish(iter);
scan_directory(ctx, ver, sha, path, iter)?;
} else {
let path = fs::resolve(ctx.fs, path);
diff --git a/hare/module/walk.ha b/hare/module/walk.ha
@@ -37,6 +37,7 @@ fn _walk(
case let iter: *fs::iterator =>
yield iter;
};
+ defer fs::finish(iter);
// TODO: Refactor me to use path::buffer
for (true) {