mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-15 10:18:39 -09:00
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
This commit is contained in:
parent
890e5a4af7
commit
4d124c7c3d
1 changed files with 1 additions and 1 deletions
|
|
@ -276,7 +276,7 @@ pub const Link = extern struct {
|
||||||
name: [0]u8 = undefined,
|
name: [0]u8 = undefined,
|
||||||
|
|
||||||
// Return value should be freed with main.allocator.
|
// 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);
|
var out = std.ArrayList(u8).init(main.allocator);
|
||||||
self.parent.fmtPath(withRoot, &out);
|
self.parent.fmtPath(withRoot, &out);
|
||||||
out.append('/') catch unreachable;
|
out.append('/') catch unreachable;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue