From 3ab4107fdae29dd6536510f283b5fb1229681da4 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 4 Mar 2019 21:37:19 +0000 Subject: [PATCH] Fix NULL pointer deref in configure_root Signed-off-by: Yuxuan Shui --- src/compton.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compton.c b/src/compton.c index aa09d2d..0f99106 100644 --- a/src/compton.c +++ b/src/compton.c @@ -804,10 +804,9 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) { /// Handle configure event of a root window void configure_root(session_t *ps, int width, int height) { // On root window changes - auto bi = backend_list[ps->o.backend]; + bool has_root_change = ps->backend_data->ops->root_change != NULL; if (ps->o.experimental_backends) { - assert(bi); - if (!ps->backend_data->ops->root_change) { + if (!has_root_change) { // deinit/reinit backend if the backend cannot handle root change ps->backend_data->ops->deinit(ps->backend_data); ps->backend_data = NULL; @@ -836,7 +835,7 @@ void configure_root(session_t *ps, int width, int height) { glx_on_root_change(ps); #endif if (ps->o.experimental_backends) { - if (ps->backend_data->ops->root_change) { + if (has_root_change) { ps->backend_data->ops->root_change(ps->backend_data, ps); } else { ps->backend_data = backend_list[ps->o.backend](ps);