From 74b14edea8b7d8ae7816feda2ee37a4ca016bc03 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Wed, 28 Dec 2022 03:20:06 -0500 Subject: link: fix memory leaks * Fix linker memory leaks found while running `zig build test-cases`. * Add missing target to test manifest. --- src/link.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/link.zig') diff --git a/src/link.zig b/src/link.zig index 450763ac18..001cc709e4 100644 --- a/src/link.zig +++ b/src/link.zig @@ -223,7 +223,9 @@ pub const Options = struct { pub fn move(self: *Options) Options { const copied_state = self.*; + self.frameworks = .{}; self.system_libs = .{}; + self.force_undefined_symbols = .{}; return copied_state; } }; @@ -624,7 +626,9 @@ pub const File = struct { base.releaseLock(); if (base.file) |f| f.close(); if (base.intermediary_basename) |sub_path| base.allocator.free(sub_path); + base.options.frameworks.deinit(base.allocator); base.options.system_libs.deinit(base.allocator); + base.options.force_undefined_symbols.deinit(base.allocator); switch (base.tag) { .coff => { if (build_options.only_c) unreachable; -- cgit v1.2.3