From 4d124c7c3d8c216109f2580ab3d6a5ce6bc86c6c Mon Sep 17 00:00:00 2001 From: Yorhel Date: Wed, 2 Nov 2022 14:51:22 +0100 Subject: [PATCH] Fix struct copy and invalid pointer access in Link.path() Interesting case of https://ziglang.org/download/0.10.0/release-notes.html#Escaped-Pointer-to-Parameter --- src/model.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model.zig b/src/model.zig index 34e9a1c..d93d5b7 100644 --- a/src/model.zig +++ b/src/model.zig @@ -276,7 +276,7 @@ pub const Link = extern struct { name: [0]u8 = undefined, // Return value should be freed with main.allocator. - pub fn path(self: @This(), withRoot: bool) [:0]const u8 { + pub fn path(self: *const @This(), withRoot: bool) [:0]const u8 { var out = std.ArrayList(u8).init(main.allocator); self.parent.fmtPath(withRoot, &out); out.append('/') catch unreachable;