code: fix a pair of leaks

This commit is contained in:
Isaac Freund 2020-07-17 16:01:35 +02:00
parent 0091445b9f
commit 43bcce9afe
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 4 additions and 0 deletions

View File

@ -610,6 +610,9 @@ fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
// Clean up the wlr_output // Clean up the wlr_output
self.wlr_output.data = null; self.wlr_output.data = null;
// Free the layout command
util.gpa.free(self.layout);
// Remove the destroyed output from the list // Remove the destroyed output from the list
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self); const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
root.outputs.remove(node); root.outputs.remove(node);

View File

@ -93,6 +93,7 @@ pub fn main() anyerror!void {
} else null; } else null;
defer if (startup_process) |child| { defer if (startup_process) |child| {
_ = child.kill() catch |e| log.err(.server, "failed to terminate startup process: {}", .{e}); _ = child.kill() catch |e| log.err(.server, "failed to terminate startup process: {}", .{e});
child.deinit();
}; };
log.info(.server, "running...", .{}); log.info(.server, "running...", .{});