authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-21 12:04:27+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-21 10:08:37-04:00
log42ed34d1f6a1f6487981749eb6c31deba198aa67
tree2ea5bba0f82ba3c661f663af1101a8e4d08610c7
parentbd5831ce0e033662fed1adf98e81e7d058c6f883

macho: create LlvmObject in createEmpty only

Prior to this change we would also create it in `openPath`, but as `openPath` internally calls `createEmpty` we would end up with a memory leak.

1 files changed, 0 insertions(+), 1 deletions(-)

src/link/MachO.zig-1
...@@ -321,7 +321,6 @@ pub fn openPath(allocator: Allocator, options: link.Options) !*MachO {...@@ -321,7 +321,6 @@ pub fn openPath(allocator: Allocator, options: link.Options) !*MachO {
321 // TODO this intermediary_basename isn't enough; in the case of `zig build-exe`,321 // TODO this intermediary_basename isn't enough; in the case of `zig build-exe`,
322 // we also want to put the intermediary object file in the cache while the322 // we also want to put the intermediary object file in the cache while the
323 // main emit directory is the cwd.323 // main emit directory is the cwd.
324 self.llvm_object = try LlvmObject.create(allocator, options);
325 self.base.intermediary_basename = try std.fmt.allocPrint(allocator, "{s}{s}", .{324 self.base.intermediary_basename = try std.fmt.allocPrint(allocator, "{s}{s}", .{
326 emit.sub_path, options.object_format.fileExt(options.target.cpu.arch),325 emit.sub_path, options.object_format.fileExt(options.target.cpu.arch),
327 });326 });