From: Florin Malita <fmalita@gmail.com>
To: mchehab@infradead.org, v4l-dvb-maintainer@linuxtv.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] V4L/DVB: potential leak in dvb-bt8xx
Date: Sat, 14 Oct 2006 13:39:56 -0400 [thread overview]
Message-ID: <453120EC.8030503@gmail.com> (raw)
If dvb_attach
<http://www.coverity.com:7448/display-error.cgi?user=fmalita&magic=8997c91336813f372812011c89e0e75e&source=2693a21be69533084392e43c4f3c5220&runid=86&table=file&line=107>(dst_attach,
...) fails in *frontend_init*(), the previously allocated 'state' is
leaked (Coverity ID 1437).
Also, when allocating 'state' the result of kmalloc() needs to be checked.
Signed-off-by: Florin Malita <fmalita@gmail.com>
---
drivers/media/dvb/bt8xx/dvb-bt8xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index fb6c4cc..d22ba4e 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -665,6 +665,9 @@ static void frontend_init(struct dvb_bt8
case BTTV_BOARD_TWINHAN_DST:
/* DST is not a frontend driver !!! */
state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL);
+ if (!state)
+ break;
+
/* Setup the Card */
state->config = &dst_config;
state->i2c = card->i2c_adapter;
@@ -673,6 +676,7 @@ static void frontend_init(struct dvb_bt8
/* DST is not a frontend, attaching the ASIC */
if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
+ kfree(state);
break;
}
/* Attach other DST peripherals if any */
next reply other threads:[~2006-10-14 17:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-14 17:39 Florin Malita [this message]
2006-10-15 0:33 ` [v4l-dvb-maintainer] [PATCH] V4L/DVB: potential leak in dvb-bt8xx Trent Piepho
2006-10-15 16:02 ` Florin Malita
2006-10-15 16:35 ` Manu Abraham
2006-10-15 17:18 ` Mauro Carvalho Chehab
2006-10-15 17:39 ` Manu Abraham
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=453120EC.8030503@gmail.com \
--to=fmalita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=v4l-dvb-maintainer@linuxtv.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.