diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-14 16:16:20 +0200 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-14 16:22:31 +0200 |
commit | 4bbf718e7dca39e2838cce7c07c89faffd73840a (patch) | |
tree | 900834e7168410f2728ce4a6eb0ddb6116512f9a /backend | |
parent | ba20d5b3cae29a90b1d66c9d53f295a7c41c932e (diff) |
impl->destroy cleanup:
- remove trivial destroy() function
- make sure we check impl and impl->destroy before calling
- always call free if not implemented
Diffstat (limited to 'backend')
-rw-r--r-- | backend/backend.c | 4 | ||||
-rw-r--r-- | backend/wayland/output.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/backend/backend.c b/backend/backend.c index fc8ccdb0..790a14b3 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -32,8 +32,10 @@ bool wlr_backend_start(struct wlr_backend *backend) { } void wlr_backend_destroy(struct wlr_backend *backend) { - if (backend->impl->destroy) { + if (backend->impl && backend->impl->destroy) { backend->impl->destroy(backend); + } else { + free(backend); } } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 6a7b9e54..767d1c6b 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -103,7 +103,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { struct wlr_wl_backend_output *output; if (!(output = calloc(sizeof(struct wlr_wl_backend_output), 1))) { - wlr_log(L_ERROR, "Failed to allocate wlr_output_state"); + wlr_log(L_ERROR, "Failed to allocate wlr_wl_backend_output"); return NULL; } wlr_output_init(&output->wlr_output, &output_impl); |