]> git.sur5r.net Git - i3/i3/commitdiff
initialize variables to NULL to avoid invalid free() on error
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 29 Mar 2015 18:57:20 +0000 (20:57 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 29 Mar 2015 18:57:20 +0000 (20:57 +0200)
i3-nagbar/main.c

index eacdca19a6d640169398ea624d83e3c5dd5ce8fd..83389b34b240ed7da3f8c62152f25842a30438c6 100644 (file)
@@ -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");