From 8589ae19de1d5699a586f96fe34a35c586e1e29c Mon Sep 17 00:00:00 2001 From: random human Date: Fri, 31 Aug 2018 16:11:46 +0530 Subject: Fix bugs listed by clang's static analyzer A few pedantic changes and unused variables (1-4), and genuine bugs (5, 6). The reports with the corresponding files and lines numbers are as follows. 1. backend/libinput/tablet_pad.c@31,44,57 "Allocator sizeof operand mismatch" "Result of 'calloc' is converted to a pointer of type 'unsigned int', which is incompatible with sizeof operand type 'int'" 2. types/tablet_v2/wlr_tablet_v2_pad.c@371 "Allocator sizeof operand mismatch" "Result of 'calloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int'" 3. types/wlr_cursor.c@335 "Dead initialization" "Value stored to 'dx'/'dy' during its initialization is never read" 4. rootston/xdg_shell.c@510 "Dead initialization" "Value stored to 'desktop' during its initialization is never read" 5. types/tablet_v2/wlr_tablet_v2_pad.c@475 "Dereference of null pointer" "Access to field 'strips' results in a dereference of a null pointer (loaded from field 'current_client')" The boolean logic was incorrect (c.f. the check in the following function). 6. examples/idle.c@163,174,182 "Uninitialized argument value" "1st function call argument is an uninitialized value" If close_timeout != 0, but simulate_activity_timeout >= close_timeout, the program would segfault at pthread_cancel(t1). --- rootston/xdg_shell.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'rootston/xdg_shell.c') diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c index fed9afcd..2cf2081e 100644 --- a/rootston/xdg_shell.c +++ b/rootston/xdg_shell.c @@ -507,8 +507,6 @@ static void decoration_handle_surface_commit(struct wl_listener *listener, } void handle_xdg_toplevel_decoration(struct wl_listener *listener, void *data) { - struct roots_desktop *desktop = - wl_container_of(listener, desktop, xdg_toplevel_decoration); struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration = data; wlr_log(WLR_DEBUG, "new xdg toplevel decoration"); -- cgit v1.2.3