Skip to content

Commit

Permalink
V4L/DVB (10385): gspca - main: Fix memory leak when USB disconnection…
Browse files Browse the repository at this point in the history
… while streaming.

Resetting the streaming flag on disconnection prevented the URBs to be freed
when streaming was active.
Also, USBs cannot be killed after disconnection (oops in [usbcore] unlink1).

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jean-Francois Moine authored and Mauro Carvalho Chehab committed Jan 29, 2009
1 parent 9c06210 commit 2fd9c2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
break;

gspca_dev->urb[i] = NULL;
usb_kill_urb(urb);
if (!gspca_dev->present)
usb_kill_urb(urb);
if (urb->transfer_buffer != NULL)
usb_buffer_free(gspca_dev->dev,
urb->transfer_buffer_length,
Expand Down Expand Up @@ -1950,7 +1951,6 @@ void gspca_disconnect(struct usb_interface *intf)
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);

gspca_dev->present = 0;
gspca_dev->streaming = 0;

usb_set_intfdata(intf, NULL);

Expand Down

0 comments on commit 2fd9c2e

Please sign in to comment.