All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Chase Southwood <chase.southwood@yahoo.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: Ian Abbott <ian.abbott@mev.co.uk>,
	"hsweeten@visionengravers.com" <hsweeten@visionengravers.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>
Subject: Re: [PATCH] Staging: comedi: fix memory leak in comedi_bond.c
Date: Mon, 10 Feb 2014 12:52:42 +0000	[thread overview]
Message-ID: <52F8CB9A.4010004@mev.co.uk> (raw)
In-Reply-To: <1391835747-3714-1-git-send-email-chase.southwood@yahoo.com>

On 2014-02-08 05:02, Chase Southwood wrote:
> We allocate bdev and then krealloc the devs pointer in order to add bdev
> at the end of the devpriv->devs array list.  But if for some reason this
> krealloc fails, we need to free bdev before returning an error otherwise
> this memory is leaked.
>
> Signed-off-by: Chase Southwood <chase.southwood@yahoo.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;
>

Acked-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

      reply	other threads:[~2014-02-10 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08  5:02 [PATCH] Staging: comedi: fix memory leak in comedi_bond.c Chase Southwood
2014-02-10 12:52 ` Ian Abbott [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=52F8CB9A.4010004@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=chase.southwood@yahoo.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=ian.abbott@mev.co.uk \
    --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 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.