From 254eab059fc21459eecb5f9b8904b8b334adf4c4 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 25 May 2024 09:15:09 +0100 Subject: [PATCH] core: fix NULL-dereference of file_watch_handle It's not initialized if there is no config file to watch. Signed-off-by: Yuxuan Shui --- src/picom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/picom.c b/src/picom.c index 1e60ad19..b5e15b5d 100644 --- a/src/picom.c +++ b/src/picom.c @@ -2526,8 +2526,10 @@ static void session_destroy(session_t *ps) { command_builder_free(ps->command_builder); ps->command_builder = NULL; - file_watch_destroy(ps->loop, ps->file_watch_handle); - ps->file_watch_handle = NULL; + if (ps->file_watch_handle) { + file_watch_destroy(ps->loop, ps->file_watch_handle); + ps->file_watch_handle = NULL; + } // Stop listening to events on root window xcb_change_window_attributes(ps->c.c, ps->c.screen_info->root, XCB_CW_EVENT_MASK,