diff --git a/river/Config.zig b/river/Config.zig index ea45f38..8028009 100644 --- a/river/Config.zig +++ b/river/Config.zig @@ -62,7 +62,9 @@ pub fn init(self: *Self) !void { self.mode_to_id = std.StringHashMap(usize).init(util.gpa); errdefer self.mode_to_id.deinit(); - try self.mode_to_id.putNoClobber("normal", 0); + const owned_slice = try std.mem.dupe(util.gpa, u8, "normal"); + errdefer util.gpa.free(owned_slice); + try self.mode_to_id.putNoClobber(owned_slice, 0); self.modes = std.ArrayList(std.ArrayList(Mapping)).init(util.gpa); errdefer self.modes.deinit(); @@ -76,11 +78,15 @@ pub fn init(self: *Self) !void { } pub fn deinit(self: Self) void { + var it = self.mode_to_id.iterator(); + while (it.next()) |kv| util.gpa.free(kv.key); self.mode_to_id.deinit(); + for (self.modes.items) |mode| { for (mode.items) |mapping| mapping.deinit(util.gpa); mode.deinit(); } self.modes.deinit(); + self.float_filter.deinit(); } diff --git a/river/Output.zig b/river/Output.zig index 2f0398e..36eb343 100644 --- a/river/Output.zig +++ b/river/Output.zig @@ -105,7 +105,7 @@ pub fn init(self: *Self, root: *Root, wlr_output: *c.wlr_output) !void { self.master_factor = 0.6; - self.layout = try std.fmt.allocPrint(util.gpa, "full", .{}); + self.layout = try std.mem.dupe(util.gpa, u8, "full"); self.status_trackers = std.SinglyLinkedList(OutputStatus).init();