In das1800_attach, the buffer allocated via kmalloc_array needs to be released if an error happens. Signed-off-by: Navid Emamdoost <navid.emamdoost@xxxxxxxxx> --- drivers/staging/comedi/drivers/das1800.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index f16aa7e9f4f3..5f2d5f7a6229 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -1237,12 +1237,16 @@ static int das1800_attach(struct comedi_device *dev, dev->pacer = comedi_8254_init(dev->iobase + DAS1800_COUNTER, I8254_OSC_BASE_5MHZ, I8254_IO8, 0); - if (!dev->pacer) + if (!dev->pacer) { + kfree(devpriv->fifo_buf); return -ENOMEM; + } ret = comedi_alloc_subdevices(dev, 4); - if (ret) + if (ret) { + kfree(devpriv->fifo_buf); return ret; + } /* * Analog Input subdevice @@ -1290,8 +1294,10 @@ static int das1800_attach(struct comedi_device *dev, s->insn_write = das1800_ao_insn_write; ret = comedi_alloc_subdev_readback(s); - if (ret) + if (ret) { + kfree(devpriv->fifo_buf); return ret; + } /* initialize all channels to 0V */ for (i = 0; i < s->n_chan; i++) { -- 2.17.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel