Skip to content

Commit

Permalink
[PATCH] usb: ati remote memleak fix
Browse files Browse the repository at this point in the history
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 <m.kozlowski@tuxland.pl>
Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Mariusz Kozlowski authored and Linus Torvalds committed Nov 25, 2006
1 parent cfd3ef2 commit 9dce447
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/usb/input/ati_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,11 @@ static void ati_remote_free_buffers(struct ati_remote *ati_remote)
if (ati_remote->out_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);
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->outbuf, ati_remote->outbuf_dma);
}

static void ati_remote_input_init(struct ati_remote *ati_remote)
Expand Down

0 comments on commit 9dce447

Please sign in to comment.