Commit 777e5d3e authored by Chase Southwood's avatar Chase Southwood Committed by Greg Kroah-Hartman

Staging: comedi: fix memory leak in comedi_bond.c

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: default avatarChase Southwood <chase.southwood@yahoo.com>
Acked-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8542373d
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment