diff --git a/src/runner.zig b/src/runner.zig index 36c4687..a9ea3e3 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -40,6 +40,8 @@ pub const Runner = struct { if (self.image) |image| { image.close(); } + + std.process.argsFree(self.allocator, self.args); } pub fn clone(self: *Runner) !Runner { @@ -117,6 +119,7 @@ pub const Runner = struct { } } + /// Caller owns returned memory. fn makeGlitchedPath(self: *Runner) ![]const u8 { // we want to transform basename, if it is "x.bmp" to "x_gN.bmp", where // N is the maximum non-used integer. @@ -180,6 +183,7 @@ pub const Runner = struct { fn quicksaveCmd(self: *Runner) !void { var image = try self.getImage(); const out_path = try self.makeGlitchedPath(); + defer self.allocator.free(out_path); try image.saveTo(out_path); } @@ -187,6 +191,7 @@ pub const Runner = struct { const runqs = cmd.cast(lang.Command.RunQS).?; var image = try self.getImage(); const out_path = try self.makeGlitchedPath(); + defer self.allocator.free(out_path); try image.saveTo(out_path); var proc = try std.ChildProcess.init(