aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-06-30 11:04:17 +0900
committerDominique Martinet <asmadeus@codewreck.org>2018-06-30 11:38:21 +0900
commit4cc441248121493350eb50277d2815ec31e9ea59 (patch)
treef0c1229691168f663304f334cdcef42c92746652
parentb3313b7f395983482d6efc60db039ef7a97cd6e0 (diff)
wlr_renderer_destroy: fix renderer NULL check
renderer is checked for NULL, but was dereferenced before that. Found through static analysis
-rw-r--r--render/wlr_renderer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 98c91132..00f1e411 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -25,9 +25,12 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
}
void wlr_renderer_destroy(struct wlr_renderer *r) {
+ if (!r) {
+ return;
+ }
wlr_signal_emit_safe(&r->events.destroy, r);
- if (r && r->impl && r->impl->destroy) {
+ if (r->impl && r->impl->destroy) {
r->impl->destroy(r);
} else {
free(r);