mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: Sachin Kamat <sachin.kamat@linaro.org>,
	Sourav Poddar <sourav.poddar@ti.com>, Felipe Balbi <balbi@ti.com>,
	JJ Ding <dgdunix@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Abraham Arce <x0066660@ti.com>,
	Syed Rafiuddin <rafiuddin.syed@ti.com>
Subject: Re: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()
Date: Wed, 08 Aug 2012 12:46:40 -0700	[thread overview]
Message-ID: <1545778.bUhk8oTdlK@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1208082135410.10061@swampdragon.chaosbits.net>

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

  reply	other threads:[~2012-08-08 19:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 18:16 Jesper Juhl
2012-08-08  3:43 ` Sachin Kamat
2012-08-08 19:36   ` Jesper Juhl
2012-08-08 19:46     ` Dmitry Torokhov [this message]
2012-08-08 19:57       ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1545778.bUhk8oTdlK@dtor-d630.eng.vmware.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=balbi@ti.com \
    --cc=dgdunix@gmail.com \
    --cc=jj@chaosbits.net \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafiuddin.syed@ti.com \
    --cc=sachin.kamat@linaro.org \
    --cc=sourav.poddar@ti.com \
    --cc=x0066660@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®