]> git.baikalelectronics.ru Git - kernel.git/commit
Input: da9052 - fix memory leak in da9052_onkey_probe()
authorJesper Juhl <jj@chaosbits.net>
Thu, 12 Apr 2012 03:55:18 +0000 (20:55 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 12 Apr 2012 05:15:04 +0000 (22:15 -0700)
commitbb0b325fc69c6f09d0bab8623a79662027afc45d
treeaf1258e22b8ded4e7d4d0f123b06335c9c7cb1d4
parente7d0185b507a784221a2d38b549e514d2a98783c
Input: da9052 - fix memory leak in da9052_onkey_probe()

If, in drivers/input/misc/da9052_onkey.c::da9052_onkey_probe(), the
call to either kzalloc() or input_allocate_device() fails then we will
return -ENOMEM from the function without freeing the other allocation
that may have succeeded, thus we leak either the memory allocated for
'onkey' or the memory allocated for 'input_dev' if one succeeds and
the other fails.
Fix that by jumping to the 'err_free_mem' label at the end of the
function that properly cleans up rather than returning directly.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/misc/da9052_onkey.c