From 70cc3185181109a43871b65771891ce3d733b0fe Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Mon, 1 Jun 2020 14:41:44 +0200 Subject: Implement bind command This command allows binding compsitor commands to keys --- src/Control.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Control.zig') diff --git a/src/Control.zig b/src/Control.zig index 6a94502..e9ae576 100644 --- a/src/Control.zig +++ b/src/Control.zig @@ -110,9 +110,12 @@ fn runCommand( var failure_message: []const u8 = undefined; command.run(allocator, seat, args.items, &failure_message) catch |err| { if (err == command.Error.CommandFailed) { - const out = std.cstr.addNullByte(allocator, failure_message) catch "out of memory"; + defer allocator.free(failure_message); + const out = std.cstr.addNullByte(allocator, failure_message) catch { + c.zriver_command_callback_v1_send_failure(callback_resource, "out of memory"); + return; + }; defer allocator.free(out); - allocator.free(failure_message); c.zriver_command_callback_v1_send_failure(callback_resource, out); } else { c.zriver_command_callback_v1_send_failure( -- cgit v1.2.3