提交 fa3b5d9a 编写于 作者: I Ian Abbott 提交者: Greg Kroah-Hartman

Staging: comedi: serial2002: Fix memory leak on detach

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: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 9e7f2256
...@@ -903,7 +903,7 @@ static int serial2002_detach(struct comedi_device *dev) ...@@ -903,7 +903,7 @@ static int serial2002_detach(struct comedi_device *dev)
int i; int i;
printk("comedi%d: serial2002: remove\n", dev->minor); printk("comedi%d: serial2002: remove\n", dev->minor);
for (i = 0; i < 4; i++) { for (i = 0; i < 5; i++) {
s = &dev->subdevices[i]; s = &dev->subdevices[i];
if (s->maxdata_list) { if (s->maxdata_list) {
kfree(s->maxdata_list); kfree(s->maxdata_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册