aboutsummaryrefslogtreecommitdiff
path: root/core/path
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-10-27 12:10:10 +0000
committergingerBill <bill@gingerbill.org>2024-10-27 12:10:10 +0000
commit35d818bb4ee041741e64101da9ea957feae9e99d (patch)
tree533e0a1a4277ce2b7cc4d6ed2e956b50946a5b5f /core/path
parentf32e27d2e4e4fb45206b5b6c36f5264636979ff7 (diff)
Fix possible leak in recursive `filepath.glob`
Diffstat (limited to 'core/path')
-rw-r--r--core/path/filepath/match.odin7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/path/filepath/match.odin b/core/path/filepath/match.odin
index 7eb72b9a7..003f8046d 100644
--- a/core/path/filepath/match.odin
+++ b/core/path/filepath/match.odin
@@ -246,6 +246,13 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
if err != .None {
return
}
+ defer {
+ for s in m {
+ delete(s)
+ }
+ delete(m)
+ }
+
dmatches := make([dynamic]string, 0, 0)
for d in m {
dmatches, err = _glob(d, file, &dmatches)