public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Yoichi Yuasa <yuasa@linux-mips.org>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: yuasa@linux-mips.org, linux-media@vger.kernel.org
Subject: [PATCH] fix memory leak media IR keytable
Date: Thu, 4 Feb 2010 11:01:44 +0900	[thread overview]
Message-ID: <20100204110144.70046143.yuasa@linux-mips.org> (raw)

Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
 drivers/media/IR/ir-keytable.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index b521ed9..44501d9 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -422,8 +422,10 @@ int ir_input_register(struct input_dev *input_dev,
 	ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
 	ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
 				    sizeof(struct ir_scancode), GFP_KERNEL);
-	if (!ir_dev->rc_tab.scan)
+	if (!ir_dev->rc_tab.scan) {
+		kfree(ir_dev);
 		return -ENOMEM;
+	}
 
 	IR_dprintk(1, "Allocated space for %d keycode entries (%zd bytes)\n",
 		ir_dev->rc_tab.size,
-- 
1.6.6.1


             reply	other threads:[~2010-02-04  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04  2:01 Yoichi Yuasa [this message]
2010-02-04 12:34 ` [PATCH] fix memory leak media IR keytable Mauro Carvalho Chehab

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=20100204110144.70046143.yuasa@linux-mips.org \
    --to=yuasa@linux-mips.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.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