summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>2014-09-02 14:33:59 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-10-15 11:08:32 +0200
commit84961407a50bb02d34ab9cca7a21cdb4ff7c25fe (patch)
tree4ace33df4ff820879c3cb5c9da7eabeae2449fd6 /ui
parentb1d28ec6a7dbdaadda39d29322f0de694aeb0b74 (diff)
downloadqemu-84961407a50bb02d34ab9cca7a21cdb4ff7c25fe.tar.gz
gtk.c: Fix memory leak in gd_set_keycode_type()
this memory leak is introduced by the original commit 3158a3482b0093e41f2b2596fba50774ea31ae08 valgrind out showing: ==14553== 21,459 (72 direct, 21,387 indirect) bytes in 1 blocks are definitely lost in loss record 8,055 of 8,082 ==14553== at 0x4A06BC3: calloc (vg_replace_malloc.c:618) ==14553== by 0x80DBFBC: XkbGetKeyboardByName (in /usr/lib64/libX11.so.6.3.0) ==14553== by 0x40C704: gtk_display_init (gtk.c:1798) ==14553== by 0x1AEDC1: main (vl.c:4480) Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 2345d7e3a3..cdd2567fa0 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1810,6 +1810,13 @@ static void gd_set_keycode_type(GtkDisplayState *s)
fprintf(stderr, "unknown keycodes `%s', please report to "
"qemu-devel@nongnu.org\n", keycodes);
}
+
+ if (desc) {
+ XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, True);
+ }
+ if (keycodes) {
+ XFree(keycodes);
+ }
}
#endif
}