From 7830a441c0d4f9753dea8a72466091346ded739b Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Tue, 18 Nov 2008 10:33:08 +0100 Subject: gspca: Memory leak when disconnect while streaming. From: Jean-Francois Moine As a side effect, the sd routine stop0 is called on disconnect. This permits the subdriver to free its resources. Priority: high Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/spca505.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers/media/video/gspca/spca505.c') diff --git a/linux/drivers/media/video/gspca/spca505.c b/linux/drivers/media/video/gspca/spca505.c index 62bab3cc1..c52598e94 100644 --- a/linux/drivers/media/video/gspca/spca505.c +++ b/linux/drivers/media/video/gspca/spca505.c @@ -811,8 +811,12 @@ static void sd_stopN(struct gspca_dev *gspca_dev) reg_write(gspca_dev->dev, 0x02, 0x00, 0x00); } +/* called on streamoff with alt 0 and on disconnect */ static void sd_stop0(struct gspca_dev *gspca_dev) { + if (!gspca_dev->present) + return; + /* This maybe reset or power control */ reg_write(gspca_dev->dev, 0x03, 0x03, 0x20); reg_write(gspca_dev->dev, 0x03, 0x01, 0x0); -- cgit v1.2.3