]> git.sur5r.net Git - i3/i3lock/commitdiff
Merge pull request #179 from karulont/master
authorIngo Bürk <admin@airblader.de>
Mon, 19 Mar 2018 13:37:37 +0000 (14:37 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Mar 2018 13:37:37 +0000 (14:37 +0100)
Fix memory leak when grabbing fails

xcb.c

diff --git a/xcb.c b/xcb.c
index 27a8daedb64a60771bc54319082234c684456f33..280be5534ede9dc9c07bb8df7bb6d4c7fa584cb0 100644 (file)
--- a/xcb.c
+++ b/xcb.c
@@ -203,6 +203,9 @@ bool grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen, xcb
             break;
         }
 
+        /* In case the grab failed, we still need to free the reply */
+        free(preply);
+
         /* Make this quite a bit slower */
         usleep(50);
 
@@ -237,6 +240,9 @@ bool grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen, xcb
             break;
         }
 
+        /* In case the grab failed, we still need to free the reply */
+        free(kreply);
+
         /* Make this quite a bit slower */
         usleep(50);