提交 84961407 编写于 作者: C Chen Fan 提交者: Gerd Hoffmann

gtk.c: Fix memory leak in gd_set_keycode_type()

 this memory leak is introduced by the original
 commit 3158a348

 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: NChen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 b1d28ec6
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册