git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit6398737d7793cda88dbe48a17a332da0d5da3cf4
parent23de83cb42
authorIsaac Freund <[email protected]>
date2020-07-17 16:01
code: fix a pair of leaks

 river/Output.zig | 3 +++
 river/main.zig   | 1 +
 2 files changed, 4 insertions(+)

diff --git a/river/Output.zig b/river/Output.zig
index c7b576e..fdefb0f 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -610,6 +610,9 @@ fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
     // Clean up the wlr_output
     self.wlr_output.data = null;
 
+    // Free the layout command
+    util.gpa.free(self.layout);
+
     // Remove the destroyed output from the list
     const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
     root.outputs.remove(node);
diff --git a/river/main.zig b/river/main.zig
index e01b95a..94eff88 100644
--- a/river/main.zig
+++ b/river/main.zig
@@ -93,6 +93,7 @@ pub fn main() anyerror!void {
     } else null;
     defer if (startup_process) |child| {
         _ = child.kill() catch |e| log.err(.server, "failed to terminate startup process: {}", .{e});
+        child.deinit();
     };
 
     log.info(.server, "running...", .{});