aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-12-15 18:26:53 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-15 19:01:41 -0500
commit10c8b73075fa0dd5512cc14be7240ec47f68dece (patch)
treee8835ef640d1d21ce0f36a5b1bcee726d926e55e /sway/input.c
parentAdd remaining sway allocation failure handling (diff)
downloadsway-10c8b73075fa0dd5512cc14be7240ec47f68dece.tar.gz
sway-10c8b73075fa0dd5512cc14be7240ec47f68dece.tar.zst
sway-10c8b73075fa0dd5512cc14be7240ec47f68dece.zip
Handle calloc failures
Diffstat (limited to 'sway/input.c')
-rw-r--r--sway/input.c10
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 @@
11 11
12struct input_config *new_input_config(const char* identifier) { 12struct input_config *new_input_config(const char* identifier) {
13 struct input_config *input = calloc(1, sizeof(struct input_config)); 13 struct input_config *input = calloc(1, sizeof(struct input_config));
14 if (!input) {
15 sway_log(L_DEBUG, "Unable to allocate input config");
16 return NULL;
17 }
14 sway_log(L_DEBUG, "new_input_config(%s)", identifier); 18 sway_log(L_DEBUG, "new_input_config(%s)", identifier);
15 input->identifier = strdup(identifier); 19 if (!(input->identifier = strdup(identifier))) {
20 free(input);
21 sway_log(L_DEBUG, "Unable to allocate input config");
22 return NULL;
23 }
16 24
17 input->tap = INT_MIN; 25 input->tap = INT_MIN;
18 input->drag_lock = INT_MIN; 26 input->drag_lock = INT_MIN;