From 1032a693211dd96abe349bfa76b43bb1f226cfda Mon Sep 17 00:00:00 2001 From: Martin Wickham Date: Sun, 31 Jan 2021 13:02:19 -0600 Subject: Dupe strings on all public api points for std.build --- lib/std/build/write_file.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/std/build/write_file.zig') diff --git a/lib/std/build/write_file.zig b/lib/std/build/write_file.zig index bbe6ec5086..6e88aa5633 100644 --- a/lib/std/build/write_file.zig +++ b/lib/std/build/write_file.zig @@ -32,7 +32,10 @@ pub const WriteFileStep = struct { } pub fn add(self: *WriteFileStep, basename: []const u8, bytes: []const u8) void { - self.files.append(.{ .basename = basename, .bytes = bytes }) catch unreachable; + self.files.append(.{ + .basename = self.builder.dupePath(basename), + .bytes = self.builder.dupe(bytes), + }) catch unreachable; } /// Unless setOutputDir was called, this function must be called only in -- cgit v1.2.3