Skip to content

Commit

Permalink
win: fix memory leak in fill_win
Browse files Browse the repository at this point in the history
Fixes the following memory leak reported by valgrind:

    1,056 bytes in 24 blocks are definitely lost in loss record 83 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x11FD5B: fill_win (win.c:1165)
       by 0x117CE6: handle_new_windows (compton.c:1266)
       by 0x118065: _draw_callback (compton.c:1333)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x11AD65: session_run (compton.c:2226)

This one out of multiple code paths forgot to free the structure. Yeah,
manual memory management is hard. :-)
  • Loading branch information
liskin authored and yshui committed Sep 21, 2019
1 parent e55d1d4 commit 14df3ba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ struct win *fill_win(session_t *ps, struct win *w) {
if (a->_class == XCB_WINDOW_CLASS_INPUT_ONLY) {
// No need to manage this window, but we still keep it on the window stack
w->managed = false;
free(a);
return w;
}

Expand Down

0 comments on commit 14df3ba

Please sign in to comment.