Skip to content

Commit

Permalink
src/Dependencies.zig: fix lifetime for root_package_name
Browse files Browse the repository at this point in the history
I'm not sure if it is an issue for current code, but when porting to ZTL
it crashed when accessing it, I presume because of deinit'ing
`BuildZigZon` right after `fetch:` scope.

Signed-off-by: Eric Joldasov <[email protected]>
  • Loading branch information
BratishkaErik committed Jan 30, 2025
1 parent 3ece246 commit c579ec9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Dependencies.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub const empty: Dependencies = .{
};

pub fn deinit(self: Dependencies, allocator: std.mem.Allocator) void {
allocator.free(self.root_package_name);
for (self.tarball) |tarball| {
allocator.free(tarball.name);
allocator.free(tarball.url);
Expand Down Expand Up @@ -395,7 +396,7 @@ pub fn collect(
}

return .{
.root_package_name = project_build_zig_zon_struct.name,
.root_package_name = try gpa.dupe(u8, project_build_zig_zon_struct.name),
.tarball = try array.toOwnedSlice(gpa),
.git_commit = try packaging_needed.toOwnedSlice(gpa),
};
Expand Down

0 comments on commit c579ec9

Please sign in to comment.