Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

2012-08-08 Thread Jesper Juhl
On Wed, 8 Aug 2012, Dmitry Torokhov wrote: > On Wednesday, August 08, 2012 09:36:51 PM Jesper Juhl wrote: > > On Wed, 8 Aug 2012, Sachin Kamat wrote: > > > On 7 August 2012 23:46, Jesper Juhl wrote: > > > > If omap4_keypad_parse_dt() does not return 0 (zero) in > > > > omap4_keypad_probe() we wil

Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

2012-08-08 Thread Dmitry Torokhov
On Wednesday, August 08, 2012 09:36:51 PM Jesper Juhl wrote: > On Wed, 8 Aug 2012, Sachin Kamat wrote: > > On 7 August 2012 23:46, Jesper Juhl wrote: > > > If omap4_keypad_parse_dt() does not return 0 (zero) in > > > omap4_keypad_probe() we will leak the memory we allocated for > > > 'keypad_data'

Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

2012-08-08 Thread Jesper Juhl
On Wed, 8 Aug 2012, Sachin Kamat wrote: > On 7 August 2012 23:46, Jesper Juhl wrote: > > If omap4_keypad_parse_dt() does not return 0 (zero) in > > omap4_keypad_probe() we will leak the memory we allocated for > > 'keypad_data' with kzalloc() when we return and the variable goes out > > of scope.

Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

2012-08-07 Thread Sachin Kamat
On 7 August 2012 23:46, Jesper Juhl wrote: > If omap4_keypad_parse_dt() does not return 0 (zero) in > omap4_keypad_probe() we will leak the memory we allocated for > 'keypad_data' with kzalloc() when we return and the variable goes out > of scope. How about using devm_kzalloc() instead which will

[PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

2012-08-07 Thread Jesper Juhl
If omap4_keypad_parse_dt() does not return 0 (zero) in omap4_keypad_probe() we will leak the memory we allocated for 'keypad_data' with kzalloc() when we return and the variable goes out of scope. Fix the leak by jumping to the 'err_free_keypad' label where we properly free the allocated memory, in