input: Fix weston_seat_init_keyboard() error path
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Fri, 31 Jan 2014 15:35:45 +0000 (17:35 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Sat, 1 Feb 2014 09:14:22 +0000 (01:14 -0800)
commit4d363cfcf6025db2277005845957e0b0e956ebd0
treeded678ab4e0af1a9646059224b9b4c85ddc7f1dd
parent23900f70e57277805db652316b76d18b2d59281c
input: Fix weston_seat_init_keyboard() error path

The pointer seat->keyboard was set before some possible error returns.
That pointer was left unchanged in case of failure, pointing to an
uninitialized keyboard struct (that was also leaked). If a client sent
a wl_seat::get_keyboard request, that would cause Weston to crash.

Fix this by setting the seat->keyboard pointer only after the keymap
initialization is done and there is no more possibilities for failure.
Also plug the memory leaks on the error path.

https://bugs.freedesktop.org/show_bug.cgi?id=74035
src/input.c