mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Miloslav Trmac <mitr@volny.cz>,
	Rakib Mullick <rakib.mullick@gmail.com>, TJ <ubuntu@tjworld.net>,
	Julia Lawall <julia@diku.dk>,
	Samu Onkalo <samu.p.onkalo@nokia.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH] wistron_btns: fix a memory leak in wb_module_init error path
Date: Mon, 28 Jun 2010 01:02:35 -0700	[thread overview]
Message-ID: <20100628080235.GB25287@core.coreip.homeip.net> (raw)
In-Reply-To: <1277706620.4148.2.camel@mola>

Hi Axel,

On Mon, Jun 28, 2010 at 02:30:20PM +0800, Axel Lin wrote:
> select_keymap calls copy_keymap to allocate a memory for keymap.
> This patch adds a missing kfree(keymap) in wb_module_init error path.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/input/misc/wistron_btns.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
> index 4dac8b7..55ce70e 100644
> --- a/drivers/input/misc/wistron_btns.c
> +++ b/drivers/input/misc/wistron_btns.c
> @@ -1371,6 +1371,7 @@ static int __init wb_module_init(void)
>  	platform_driver_unregister(&wistron_driver);
>   err_unmap_bios:
>  	unmap_bios();
> +	kfree(keymap);

Thank you for the patch, however this is not quite enough - we also need
to free keymap when map_bios() call fails instead of returning
immediately.

I fixed up locally and applied the patch.

-- 
Dmitry

      reply	other threads:[~2010-06-28  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28  6:30 Axel Lin
2010-06-28  8:02 ` Dmitry Torokhov [this message]

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=20100628080235.GB25287@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=axel.lin@gmail.com \
    --cc=julia@diku.dk \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mitr@volny.cz \
    --cc=rakib.mullick@gmail.com \
    --cc=samu.p.onkalo@nokia.com \
    --cc=ubuntu@tjworld.net \
    /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®