From: Michael Stapelberg Date: Sun, 29 Mar 2015 18:57:20 +0000 (+0200) Subject: initialize variables to NULL to avoid invalid free() on error X-Git-Tag: 4.11~166 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=dfefb10d367312db1c60a0a29c251e170cd0a93e;hp=3191be366d0f7d034e66f13019b4c7ea65b34f8d initialize variables to NULL to avoid invalid free() on error --- diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index eacdca19..83389b34 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -300,8 +300,8 @@ static xcb_rectangle_t get_window_position(void) { xcb_randr_get_screen_resources_current_cookie_t rcookie = xcb_randr_get_screen_resources_current(conn, root); xcb_randr_get_output_primary_cookie_t pcookie = xcb_randr_get_output_primary(conn, root); - xcb_randr_get_output_primary_reply_t *primary; - xcb_randr_get_screen_resources_current_reply_t *res; + xcb_randr_get_output_primary_reply_t *primary = NULL; + xcb_randr_get_screen_resources_current_reply_t *res = NULL; if ((primary = xcb_randr_get_output_primary_reply(conn, pcookie, NULL)) == NULL) { DLOG("Could not determine the primary output.\n");