From bcf485342ef5823c61e273fff8f1b59cf0243df6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 24 Oct 2022 16:17:18 -0700 Subject: [PATCH] fix a couple more memory leaks --- src/Window.zig | 1 + src/input/Binding.zig | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/Window.zig b/src/Window.zig index 71b3dac29..cc0ef56ea 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -632,6 +632,7 @@ pub fn destroy(self: *Window) void { self.font_group.deinit(self.alloc); self.font_lib.deinit(); + self.alloc.destroy(self.font_group); self.alloc_io_arena.deinit(); self.alloc.destroy(self.renderer_state.mutex); diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 184fd7217..fce563b08 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -171,6 +171,11 @@ pub const Set = struct { /// The set of bindings. bindings: HashMap = .{}, + pub fn deinit(self: *Set, alloc: Allocator) void { + self.bindings.deinit(alloc); + self.* = undefined; + } + /// Add a binding to the set. If the binding already exists then /// this will overwrite it. pub fn put(self: *Set, alloc: Allocator, t: Trigger, action: Action) !void {