make Image free its paths

This commit is contained in:
Luna 2020-08-18 20:57:33 -03:00
parent 9527426d48
commit 77cceab288
2 changed files with 5 additions and 3 deletions

View File

@ -179,8 +179,9 @@ pub const Image = struct {
}
pub fn close(self: *Image) void {
//self.allocator.free(self.path);
//self.allocator.free(self.curpath);
self.allocator.free(self.path);
self.allocator.free(self.curpath);
var st: i32 = c.sf_close(self.sndfile);
if (st != 0) {

View File

@ -78,6 +78,7 @@ pub const Runner = struct {
}
}
// Caller owns returned memory.
fn resolveArgPath(self: *Runner, path_or_argidx: []const u8) ![]const u8 {
const path = try self.resolveArg(path_or_argidx);
const resolved_path = try std.fs.path.resolve(
@ -89,7 +90,7 @@ pub const Runner = struct {
}
fn loadCmd(self: *Runner, path_or_argidx: []const u8) !void {
var load_path = try self.resolveArgPath(path_or_argidx);
const load_path = try self.resolveArgPath(path_or_argidx);
std.debug.warn("\tload path: {}\n", .{load_path});
// we could use ImageMagick to convert from X to BMP