aboutsummaryrefslogtreecommitdiff
path: root/lib/std/build.zig
diff options
context:
space:
mode:
authormeme <meme@users.noreply.github.com>2020-01-30 20:00:05 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-01-30 20:57:31 -0500
commit1e78070a40bac709bfd25beb24c1721d4977a69d (patch)
tree773521dd81a3061e453da40bf2f720097d7eb3e1 /lib/std/build.zig
parentd27678fe83f8c7d61cc41c7300d68fe502dd4999 (diff)
downloadzig-1e78070a40bac709bfd25beb24c1721d4977a69d.tar.gz
zig-1e78070a40bac709bfd25beb24c1721d4977a69d.zip
build: Fix missing `dupe`
- Strange memory corruption issues occur when allocated memory is passed to the builder and it is `defer`'d and freed - Instead, `dupe` the string as is done in other handlers, this fixes the issue
Diffstat (limited to 'lib/std/build.zig')
-rw-r--r--lib/std/build.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index 2b9a8ddcd6..4537d5dd07 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -1735,17 +1735,17 @@ pub const LibExeObjStep = struct {
}
pub fn addLibPath(self: *LibExeObjStep, path: []const u8) void {
- self.lib_paths.append(path) catch unreachable;
+ self.lib_paths.append(self.builder.dupe(path)) catch unreachable;
}
pub fn addFrameworkDir(self: *LibExeObjStep, dir_path: []const u8) void {
- self.framework_dirs.append(dir_path) catch unreachable;
+ self.framework_dirs.append(self.builder.dupe(dir_path)) catch unreachable;
}
pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void {
self.packages.append(Pkg{
- .name = name,
- .path = pkg_index_path,
+ .name = self.builder.dupe(name),
+ .path = self.builder.dupe(pkg_index_path),
}) catch unreachable;
}