Free keymap on error in Xephyr's hostx_load_keymap
Found by parfait 1.1 code analyser: Memory leak of pointer 'keymap' allocated with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width) at line 861 of hw/kdrive/ephyr/hostx.c in function 'hostx_load_keymap'. 'keymap' allocated at line 845 with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
48b9465120
commit
89badba082
@ -858,7 +858,7 @@ hostx_load_keymap(void)
|
||||
(max_keycode - min_keycode + 1) *
|
||||
width);
|
||||
if (!ephyrKeySyms.map)
|
||||
return;
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < (max_keycode - min_keycode + 1); i++)
|
||||
for (j = 0; j < width; j++)
|
||||
@ -871,6 +871,7 @@ hostx_load_keymap(void)
|
||||
ephyrKeySyms.maxKeyCode = max_keycode;
|
||||
ephyrKeySyms.mapWidth = width;
|
||||
|
||||
out:
|
||||
XFree(keymap);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user