aboutsummaryrefslogtreecommitdiff
path: root/backend/multi
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-15 12:21:58 -0400
committerGitHub <noreply@github.com>2017-08-15 12:21:58 -0400
commit27c13d621df7b38d04f8ffb3012aa977d1b9bb24 (patch)
tree4cf9539672adb77ddc6ac2110a6f4458b386e9a1 /backend/multi
parentf60b53c6e3c91aefa432ce75deb89560a8e5c0d7 (diff)
parent5cc7342606dbbd5e6932b39e6b1b5645164669bf (diff)
Merge pull request #88 from 4e554c4c/alloc_crashing
Prevent alloc errors from crashing
Diffstat (limited to 'backend/multi')
-rw-r--r--backend/multi/backend.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 9afca47d..290b9678 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -115,7 +115,11 @@ void wlr_multi_backend_add(struct wlr_backend *_multi,
assert(wlr_backend_is_multi(_multi));
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)_multi;
- struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
+ struct subbackend_state *sub;
+ if (!(sub = calloc(1, sizeof(struct subbackend_state)))) {
+ wlr_log(L_ERROR, "Could not add backend: allocation failed");
+ return;
+ }
sub->backend = backend;
sub->container = &multi->backend;