Package: libkeybinder0
Version: 0.3.0-3
Severity: normal
Tags: patch

Hello,

Please consider apllying the following patch, which fixes a per-key
memory leak in the libkeybinder0:

https://github.com/lumag/keybinder/commit/d9f0a1ff32050683300e2b981aeaab18d5d34041

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.2.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages libkeybinder0 depends on:
ii  libc6         2.19-22
ii  libglib2.0-0  2.46.1-1
ii  libgtk2.0-0   2.24.28-1
ii  libx11-6      2:1.6.3-1

libkeybinder0 recommends no packages.

libkeybinder0 suggests no packages.

-- no debconf information
>From d9f0a1ff32050683300e2b981aeaab18d5d34041 Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <dbarysh...@gmail.com>
Date: Thu, 5 Nov 2015 14:51:32 +0300
Subject: [PATCH] Fix memory leak in keybinder_bind_full

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)
---
 libkeybinder/bind.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libkeybinder/bind.c b/libkeybinder/bind.c
index 037d7e9..6f3855e 100644
--- a/libkeybinder/bind.c
+++ b/libkeybinder/bind.c
@@ -243,7 +243,7 @@ grab_ungrab (GdkWindow *rootwin,
 
 	}
 	g_free(keys);
-	XkbFreeClientMap(xmap, 0, TRUE);
+	XkbFreeKeyboard(xmap, 0, TRUE);
 
 	return success;
 }
-- 
2.6.2

Reply via email to