From: Axel Lin Date: Fri, 12 Nov 2010 05:43:17 +0000 (-0800) Subject: Input: xpad - fix a memory leak X-Git-Tag: v2.6.38-rc1~463^2^2~36 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=6ff92a6db2083ecd1a8e2742d9397159fd880987;p=~shefty%2Frdma-dev.git Input: xpad - fix a memory leak 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 Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 39c0265ca15..e8b2ece3e01 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -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 @@ -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 @@ -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); } }