mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 13:59:45 -04:00
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: Chase Southwood <chase.southwood@yahoo.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8542373dcc
commit
777e5d3ed5
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user