lkml.org 
[lkml]   [2012]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()
Date
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 <jj@chaosbits.net> 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 take care of freeing
> > the memory on detach?
>
> Perhaps. I'm not (yet) familiar with how that function works, so I had
> not considered it. I'll look into it.

Actually please not yet - I guess at some point I'll have to add devm_*
variants for input_device_* operations but for now I prefer not to mix
the 2 styles of managing resources.

BTW, I think I need to redo a few patches so I plan on folding this fix
into the original change.

Thanks.

--
Dmitry


\
 
 \ /
  Last update: 2012-08-08 22:21    [W:0.931 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site