From c87e4a9be69458f20c9ac7a0a9af40761918afaa Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Thu, 4 Jun 2026 20:54:08 +0100 Subject: [PATCH] FIX: defer allocator During the zig 0.16.0 upgrade a `allocator.free` was not defered. This caused the origins not to be configured correctlly. Signed-off-by: Jim Fitzpatrick --- .changes/unreleased/Fixed-20260604-205235.yaml | 3 +++ src/root.zig | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20260604-205235.yaml diff --git a/.changes/unreleased/Fixed-20260604-205235.yaml b/.changes/unreleased/Fixed-20260604-205235.yaml new file mode 100644 index 0000000..247a008 --- /dev/null +++ b/.changes/unreleased/Fixed-20260604-205235.yaml @@ -0,0 +1,3 @@ +kind: Fixed +body: Working path was de-allocator before use. This cause the origins not to be configured correctly. This bug was introduced during the zig 0.16.0 upgrade. +time: 2026-06-04T20:52:35.308341822+01:00 diff --git a/src/root.zig b/src/root.zig index 05f032b..6ae51b6 100644 --- a/src/root.zig +++ b/src/root.zig @@ -237,7 +237,7 @@ pub fn linkGit(io: std.Io, path: std.Io.Dir) !void { pub fn setupOrigin(allocator: std.mem.Allocator, io: std.Io, path: std.Io.Dir) !void { const _path = try path.realPathFileAlloc(io, ".", allocator); - allocator.free(_path); + defer allocator.free(_path); const cmd = [_][]const u8{ "git", "-C", @@ -260,7 +260,7 @@ pub fn setupOrigin(allocator: std.mem.Allocator, io: std.Io, path: std.Io.Dir) ! pub fn fetchOrigin(allocator: std.mem.Allocator, io: std.Io, path: std.Io.Dir) !void { const _path = try path.realPathFileAlloc(io, ".", allocator); - allocator.free(_path); + defer allocator.free(_path); const cmd = [_][]const u8{ "git", "-C", _path, "fetch", "-p", "origin" }; const result = std.process.run(allocator, io, .{ .argv = &cmd,