authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-09-25 02:05:02-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-09-25 02:05:02-07:00
log480e3f89b227c6c1d5daeb8ae8f7af46c9301637
treed64ebc4cf10a4728a631649dc78266dc95e10f10
parentaaa314f6b2ff9481eba9d0cf72ed845c78f32c36

Maker.Fuzz: fix memory leaks


2 files changed, 6 insertions(+), 5 deletions(-)

lib/compiler/Maker/Fuzz.zig+1
...@@ -161,6 +161,7 @@ pub fn deinit(fuzz: *Fuzz) void {...@@ -161,6 +161,7 @@ pub fn deinit(fuzz: *Fuzz) void {
161 fuzz.group.cancel(io);161 fuzz.group.cancel(io);
162 fuzz.prog_node.end();162 fuzz.prog_node.end();
163 gpa.free(fuzz.run_steps);163 gpa.free(fuzz.run_steps);
164 fuzz.msg_queue.deinit(gpa);
164}165}
165166
166fn rebuildTestsWorkerRun(167fn rebuildTestsWorkerRun(
lib/compiler/Maker/Step/Run.zig+5-5
...@@ -18,14 +18,13 @@ const Step = @import("../Step.zig");...@@ -18,14 +18,13 @@ const Step = @import("../Step.zig");
18const Maker = @import("../../Maker.zig");18const Maker = @import("../../Maker.zig");
19const Fuzz = @import("../../Maker/Fuzz.zig");19const Fuzz = @import("../../Maker/Fuzz.zig");
2020
21/// If this is a Zig unit test binary, this tracks the names of the unit21/// If this is a Zig unit test binary, this tracks the names of the unit tests that are also fuzz tests.
22/// tests that are also fuzz tests. Indexes cannot be used as they may22/// Indexes cannot be used as they may change between reruns. Memory owned by `Maker.gpa`.
23/// change between reruns.
24fuzz_tests: std.ArrayList([]const u8) = .empty,23fuzz_tests: std.ArrayList([]const u8) = .empty,
25cached_test_metadata: ?CachedTestMetadata = null,24cached_test_metadata: ?CachedTestMetadata = null,
2625
27/// Populated during the fuzz phase if this run step corresponds to a unit test26/// Populated during the fuzz phase if this run step corresponds to a unit test executable that contains fuzz
28/// executable that contains fuzz tests.27/// tests. `Path.sub_path` owned by `Maker.gpa`.
29rebuilt_executable: ?Path = null,28rebuilt_executable: ?Path = null,
3029
31pub fn make(30pub fn make(
...@@ -376,6 +375,7 @@ pub fn make(...@@ -376,6 +375,7 @@ pub fn make(
376pub fn deinit(run: *Run, gpa: Allocator, io: Io) void {375pub fn deinit(run: *Run, gpa: Allocator, io: Io) void {
377 _ = io;376 _ = io;
378 run.fuzz_tests.deinit(gpa);377 run.fuzz_tests.deinit(gpa);
378 if (run.rebuilt_executable) |p| gpa.free(p.sub_path);
379}379}
380380
381fn thirdPartyToggle(381fn thirdPartyToggle(