The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Levente Kurusa <levex@linux.com>
To: Ian Abbott <abbotti@mev.co.uk>,
	H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	OSUOSL Drivers <devel@driverdev.osuosl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Levente Kurusa <levex@linux.com>
Subject: [PATCH] staging: comedi: fix memory leak
Date: Fri, 14 Mar 2014 17:16:15 +0100	[thread overview]
Message-ID: <1394813775-12363-1-git-send-email-levex@linux.com> (raw)

Call kfree() on bdev. The variable is otherwise leaked.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 drivers/staging/comedi/drivers/comedi_bond.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c
index 51a59e5..406aedb 100644
--- a/drivers/staging/comedi/drivers/comedi_bond.c
+++ b/drivers/staging/comedi/drivers/comedi_bond.c
@@ -254,6 +254,7 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
 			if (!devs) {
 				dev_err(dev->class_dev,
 					"Could not allocate memory. Out of memory?\n");
+				kfree(bdev);
 				return -ENOMEM;
 			}
 			devpriv->devs = devs;
-- 
1.8.3.1


             reply	other threads:[~2014-03-14 16:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 16:16 Levente Kurusa [this message]
2014-03-15  3:30 ` [PATCH] staging: comedi: fix memory leak Chase Southwood
2014-03-15  6:55   ` Levente Kurusa
2014-03-15  7:21     ` Chase Southwood

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=1394813775-12363-1-git-send-email-levex@linux.com \
    --to=levex@linux.com \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox