public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: moinejf@free.fr, rmk+kernel@arm.linux.org.uk,
	linux-coverity@vger.kernel.org
Subject: drm/i2c: tda998x: Fix memory leak in tda998x_encoder_init error path.
Date: Wed, 12 Feb 2014 22:47:51 -0500	[thread overview]
Message-ID: <20140213034751.GA26499@redhat.com> (raw)
In-Reply-To: <20140212171058.6CCD6660CAF@gitolite.kernel.org>

Commit 6ae668cc19e8b18df28cd67b3448d9abd79284a4 introduced a memory leak
in the error path of tda998x_encoder_init

Picked up by the nightly Coverity scan. CID 1174076
    
Signed-off-by: Dave Jones <davej@fedoraproject.org>

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index fa18cf374470..faa77f543a07 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1151,8 +1151,10 @@ tda998x_encoder_init(struct i2c_client *client,
 
 	priv->current_page = 0xff;
 	priv->cec = i2c_new_dummy(client->adapter, 0x34);
-	if (!priv->cec)
+	if (!priv->cec) {
+		kfree(priv);
 		return -ENODEV;
+	}
 	priv->dpms = DRM_MODE_DPMS_OFF;
 
 	encoder_slave->slave_priv = priv;

       reply	other threads:[~2014-02-13  3:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140212171058.6CCD6660CAF@gitolite.kernel.org>
2014-02-13  3:47 ` Dave Jones [this message]
2014-02-13 19:46   ` drm/i2c: tda998x: Fix memory leak in tda998x_encoder_init error path Russell King - ARM Linux

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=20140213034751.GA26499@redhat.com \
    --to=davej@redhat.com \
    --cc=linux-coverity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moinejf@free.fr \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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