[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52F8CB9A.4010004@mev.co.uk>
Date: Mon, 10 Feb 2014 12:52:42 +0000
From: Ian Abbott <abbotti@....co.uk>
To: Chase Southwood <chase.southwood@...oo.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC: Ian Abbott <ian.abbott@....co.uk>,
"hsweeten@...ionengravers.com" <hsweeten@...ionengravers.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>
Subject: Re: [PATCH] Staging: comedi: fix memory leak in comedi_bond.c
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@...oo.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@....co.uk>
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@....co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists