]> git.sur5r.net Git - i3/i3lock/commitdiff
Fix memory leak when grabbing fails 179/head
authorKarl Tarbe <karulont@gmail.com>
Tue, 6 Mar 2018 22:53:24 +0000 (00:53 +0200)
committerKarl Tarbe <karl.tarbe@cyber.ee>
Fri, 9 Mar 2018 15:04:20 +0000 (17:04 +0200)
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);