The patch number 9605 was added via Douglas Schilling Landgraf <[EMAIL
PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]
------
From: Douglas Schilling Landgraf <[EMAIL PROTECTED]>
usb-urb: fix memory leak
Free allocated memory
Priority: high
Signed-off-by: Douglas Schilling Landgraf <[EMAIL PROTECTED]>
---
linux/drivers/media/dvb/dvb-usb/usb-urb.c | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff -r 4634e67d9ad4 -r dbae38e09e00 linux/drivers/media/dvb/dvb-usb/usb-urb.c
--- a/linux/drivers/media/dvb/dvb-usb/usb-urb.c Wed Nov 12 00:47:57 2008 -0200
+++ b/linux/drivers/media/dvb/dvb-usb/usb-urb.c Wed Nov 12 00:56:56 2008 -0200
@@ -139,7 +139,7 @@ stream->buf_list[stream->buf_num], (long
static int usb_bulk_urb_init(struct usb_data_stream *stream)
{
- int i;
+ int i, j;
if ((i = usb_allocate_stream_buffers(stream,stream->props.count,
stream->props.u.bulk.buffersize)) < 0)
@@ -147,9 +147,13 @@ static int usb_bulk_urb_init(struct usb_
/* allocate the URBs */
for (i = 0; i < stream->props.count; i++) {
- if ((stream->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL)
- return -ENOMEM;
-
+ stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!stream->urb_list[i]) {
+ deb_mem("not enough memory for urb_alloc_urb!.\n");
+ for (j = 0; j < i; j++)
+ usb_free_urb(stream->urb_list[i]);
+ return -ENOMEM;
+ }
usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
usb_rcvbulkpipe(stream->udev,stream->props.endpoint),
stream->buf_list[i],
@@ -174,9 +178,14 @@ static int usb_isoc_urb_init(struct usb_
for (i = 0; i < stream->props.count; i++) {
struct urb *urb;
int frame_offset = 0;
- if ((stream->urb_list[i] =
-
usb_alloc_urb(stream->props.u.isoc.framesperurb,GFP_ATOMIC)) == NULL)
- return -ENOMEM;
+
+ stream->urb_list[i] =
usb_alloc_urb(stream->props.u.isoc.framesperurb, GFP_ATOMIC);
+ if (!stream->urb_list[i]) {
+ deb_mem("not enough memory for urb_alloc_urb!\n");
+ for (j = 0; j < i; j++)
+ usb_free_urb(stream->urb_list[i]);
+ return -ENOMEM;
+ }
urb = stream->urb_list[i];
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/dbae38e09e00f37ee575c05ceb79131a01296022
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits