summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-11-18 10:33:08 +0100
committerJean-Francois Moine <moinejf@free.fr>2008-11-18 10:33:08 +0100
commit7830a441c0d4f9753dea8a72466091346ded739b (patch)
treea0e6285da2d73ae5b22d406c9a08db52e5f64ae7 /linux/drivers/media/video/gspca/gspca.c
parent47b954968656ce2ddac212e3750a135a4b1aa581 (diff)
downloadmediapointer-dvb-s2-7830a441c0d4f9753dea8a72466091346ded739b.tar.gz
mediapointer-dvb-s2-7830a441c0d4f9753dea8a72466091346ded739b.tar.bz2
gspca: Memory leak when disconnect while streaming.
From: Jean-Francois Moine <moinejf@free.fr> 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 <moinejf@free.fr>
Diffstat (limited to 'linux/drivers/media/video/gspca/gspca.c')
-rw-r--r--linux/drivers/media/video/gspca/gspca.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c
index 5197ccadd..d78835584 100644
--- a/linux/drivers/media/video/gspca/gspca.c
+++ b/linux/drivers/media/video/gspca/gspca.c
@@ -681,15 +681,14 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev)
{
gspca_dev->streaming = 0;
atomic_set(&gspca_dev->nevent, 0);
- if (gspca_dev->present) {
- if (gspca_dev->sd_desc->stopN)
- gspca_dev->sd_desc->stopN(gspca_dev);
- destroy_urbs(gspca_dev);
- gspca_set_alt0(gspca_dev);
- if (gspca_dev->sd_desc->stop0)
- gspca_dev->sd_desc->stop0(gspca_dev);
- PDEBUG(D_STREAM, "stream off OK");
- }
+ if (gspca_dev->present
+ && gspca_dev->sd_desc->stopN)
+ gspca_dev->sd_desc->stopN(gspca_dev);
+ destroy_urbs(gspca_dev);
+ gspca_set_alt0(gspca_dev);
+ if (gspca_dev->sd_desc->stop0)
+ gspca_dev->sd_desc->stop0(gspca_dev);
+ PDEBUG(D_STREAM, "stream off OK");
}
static void gspca_set_default_mode(struct gspca_dev *gspca_dev)