Skip to content

Commit

Permalink
Input: xpad - fix a memory leak
Browse files Browse the repository at this point in the history
In xpad_led_disconnect(), what we really want is to kfree(xpad_led).
In xpad_disconnect(), add a missing kfree(xpad->bdata) to fix the memory leak.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Axel Lin authored and Dmitry Torokhov committed Nov 12, 2010
1 parent 49cc69b commit 6ff92a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/input/joystick/xpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static void xpad_led_disconnect(struct usb_xpad *xpad)

if (xpad_led) {
led_classdev_unregister(&xpad_led->led_cdev);
kfree(xpad_led->name);
kfree(xpad_led);
}
}
#else
Expand Down Expand Up @@ -921,7 +921,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
usb_set_intfdata(intf, xpad);

/*
* Submit the int URB immediatly rather than waiting for open
* Submit the int URB immediately rather than waiting for open
* because we get status messages from the device whether
* or not any controllers are attached. In fact, it's
* exactly the message that a controller has arrived that
Expand Down Expand Up @@ -1000,6 +1000,7 @@ static void xpad_disconnect(struct usb_interface *intf)
usb_free_urb(xpad->irq_in);
usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
xpad->idata, xpad->idata_dma);
kfree(xpad->bdata);
kfree(xpad);
}
}
Expand Down

0 comments on commit 6ff92a6

Please sign in to comment.