sonar

Scan files at memory bandwidth speed.
Log | Files | Refs

commit 2c30a3334f018f8de99f3dca9e59f88c7a5a2143
parent 69a16c1b504e0c21eaa0ba7d999b5ce077b32eea
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Fri, 18 Sep 2026 16:57:14 -0400

walk: free a directory path when the scan is cancelled

The early return for cancellation sat above the defer that frees the path,
so every directory in flight at the moment of a cancel leaked its path.
Moving the defer up covers that exit too.

Diffstat:
Mwalk/walk.odin | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/walk/walk.odin b/walk/walk.odin @@ -116,10 +116,10 @@ Worker :: struct { @(private) walk_dir :: proc(d: Dir, w: ^Worker) -> bool { + defer delete(d.path, w.allocator) if scan.cancelled(w.writer.tree) { return false } - defer delete(d.path, w.allocator) f, open_err := os.open(d.path) if open_err != nil { // A directory we may not read is not a reason to abandon the scan; it is