[PATCH 3/5] Staging: comedi: serial2002: Fix memory leak on detach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The comedi device 'detach' method for the serial2002 driver has an
off-by-one error in its loop for freeing data belonging to its
subdevices.  Fix it.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/serial2002.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index 880fe89..6813e34 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -903,7 +903,7 @@ static int serial2002_detach(struct comedi_device *dev)
 	int i;
 
 	printk("comedi%d: serial2002: remove\n", dev->minor);
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < 5; i++) {
 		s = &dev->subdevices[i];
 		if (s->maxdata_list) {
 			kfree(s->maxdata_list);
-- 
1.7.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux