[PATCH] usb: ati remote memleak fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

	This is a bug. When checking for ati_remote->outbuf we free
freeing ati_remote->inbuf so we end up freeing ati_remote->inbuf twice.
Also the checks for 'ati_remote->inbuf != NULL' and
'ati_remote->outbuf != NULL' are redundant as usb_buffer_free() does
this.

Signed-off-by: Mariusz Kozlowski <[email protected]>

 drivers/usb/input/ati_remote.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff -up linux-2.6.19-rc5-mm2-a/drivers/usb/input/ati_remote.c linux-2.6.19-rc5-mm2-b/drivers/usb/input/ati_remote.c
--- linux-2.6.19-rc5-mm2-a/drivers/usb/input/ati_remote.c	2006-11-15 11:24:24.000000000 +0100
+++ linux-2.6.19-rc5-mm2-b/drivers/usb/input/ati_remote.c	2006-11-15 16:33:02.000000000 +0100
@@ -633,13 +633,11 @@ static void ati_remote_free_buffers(stru
 	usb_free_urb(ati_remote->irq_urb);
 	usb_free_urb(ati_remote->out_urb);

-	if (ati_remote->inbuf)
-		usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
-				ati_remote->inbuf, ati_remote->inbuf_dma);
-
-	if (ati_remote->outbuf)
-		usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
-				ati_remote->inbuf, ati_remote->outbuf_dma);
+	usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
+		ati_remote->inbuf, ati_remote->inbuf_dma);
+
+	usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
+		ati_remote->outbuf, ati_remote->outbuf_dma);
 }



-- 
Regards,

	Mariusz Kozlowski
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux