From 35d818bb4ee041741e64101da9ea957feae9e99d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 27 Oct 2024 12:10:10 +0000 Subject: [PATCH] Fix possible leak in recursive `filepath.glob` --- core/path/filepath/match.odin | 7 +++++++ 1 file changed, 7 insertions(+) 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)