diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-01-05 09:23:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 09:23:13 -0500 |
commit | c5452a3220b0f42c310a17a375908535e661debf (patch) | |
tree | eb3977fb64b7b739f8575d03402e235fa9836921 /sway/commands | |
parent | 7dad5cd18c57d632093778e526a811d07aca8fe6 (diff) | |
parent | 19ddb70a3296a7cc3256be65c488c18d87de4261 (diff) | |
download | sway-c5452a3220b0f42c310a17a375908535e661debf.tar.xz |
Merge pull request #1552 from martinetd/cleanup
config cleanup & implement free_config
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/input.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c index ccb1d276..edf45e4c 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c @@ -24,7 +24,11 @@ struct cmd_results *cmd_input(int argc, char **argv) { char **argv_new = argv+2; struct cmd_results *res; + struct input_config *old_input_config = current_input_config; current_input_config = new_input_config(argv[0]); + if (!current_input_config) { + return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config"); + } if (strcasecmp("accel_profile", argv[1]) == 0) { res = input_cmd_accel_profile(argc_new, argv_new); } else if (strcasecmp("click_method", argv[1]) == 0) { @@ -60,6 +64,7 @@ struct cmd_results *cmd_input(int argc, char **argv) { } else { res = cmd_results_new(CMD_INVALID, "input <device>", "Unknown command %s", argv[1]); } - current_input_config = NULL; + free_input_config(current_input_config); + current_input_config = old_input_config; return res; } |