Navigation Menu

Skip to content

Commit

Permalink
Fix memory leak in keybinder_bind_full
Browse files Browse the repository at this point in the history
Resources allocated by XkbGetMap() should be freed by XkbFreeKeyboard.
Otherwise I get the following leaked memory report from Valgrind:

==14972== 1,920 bytes in 48 blocks are definitely lost in loss record 1,598 of 1,626
==14972==    at 0x402C118: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14972==    by 0x5064EA8: XkbGetMap (in /usr/lib/i386-linux-gnu/libX11.so.6.3.0)
==14972==    by 0x428019D: grab_ungrab (bind.c:203)
==14972==    by 0x4280320: do_grab_key (bind.c:326)
==14972==    by 0x4280721: keybinder_bind_full (bind.c:574)
==14972==    by 0x4280791: keybinder_bind (bind.c:539)
==14972==    by 0x8049220: xvd_keys_init (xvd_keys.c:141)
==14972==    by 0x8048F84: main (main.c:126)
  • Loading branch information
lumag committed Nov 5, 2015
1 parent 663b184 commit d9f0a1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libkeybinder/bind.c
Expand Up @@ -243,7 +243,7 @@ grab_ungrab (GdkWindow *rootwin,

}
g_free(keys);
XkbFreeClientMap(xmap, 0, TRUE);
XkbFreeKeyboard(xmap, 0, TRUE);

return success;
}
Expand Down

0 comments on commit d9f0a1f

Please sign in to comment.