diff options
author | Drew DeVault <[email protected]> | 2016-12-15 18:26:53 -0500 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2016-12-15 19:01:41 -0500 |
commit | 10c8b73075fa0dd5512cc14be7240ec47f68dece (patch) | |
tree | e8835ef640d1d21ce0f36a5b1bcee726d926e55e /sway/input.c | |
parent | a2b914965686bb4352b8ebc4a46d898f5a793647 (diff) |
Handle calloc failures
Diffstat (limited to 'sway/input.c')
-rw-r--r-- | sway/input.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/input.c b/sway/input.c index 61757ab8..249d95c6 100644 --- a/sway/input.c +++ b/sway/input.c @@ -11,8 +11,16 @@ struct input_config *new_input_config(const char* identifier) { struct input_config *input = calloc(1, sizeof(struct input_config)); + if (!input) { + sway_log(L_DEBUG, "Unable to allocate input config"); + return NULL; + } sway_log(L_DEBUG, "new_input_config(%s)", identifier); - input->identifier = strdup(identifier); + if (!(input->identifier = strdup(identifier))) { + free(input); + sway_log(L_DEBUG, "Unable to allocate input config"); + return NULL; + } input->tap = INT_MIN; input->drag_lock = INT_MIN; |