From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Marko Friedemann <mfr@bmx-chemnitz.de>,
Christoph Fritz <chf.fritz@googlemail.com>,
linux-input@vger.kernel.org
Subject: [PATCH 2/3] Input: xpad - fix a memory leak
Date: Fri, 12 Nov 2010 10:49:40 +0800 [thread overview]
Message-ID: <1289530180.20782.3.camel@mola> (raw)
In-Reply-To: <1289530116.20782.2.camel@mola>
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>
---
drivers/input/joystick/xpad.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 39c0265..26b2f2b 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
@@ -989,6 +989,7 @@ static void xpad_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
if (xpad) {
+ kfree(xpad->bdata);
xpad_led_disconnect(xpad);
input_unregister_device(xpad->dev);
xpad_deinit_output(xpad);
--
1.7.2
next prev parent reply other threads:[~2010-11-12 2:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 2:48 [PATCH 1/3] Input: xpad - return proper error in error path Axel Lin
2010-11-12 2:49 ` Axel Lin [this message]
2010-11-12 2:51 ` [PATCH 3/3] Input: xpad - fix resource reclaim in xpad_probe " Axel Lin
2010-11-12 6:06 ` [PATCH 1/3] Input: xpad - return proper error in " Dmitry Torokhov
2010-11-12 13:41 ` Oliver Neukum
2010-11-12 17:33 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289530180.20782.3.camel@mola \
--to=axel.lin@gmail.com \
--cc=chf.fritz@googlemail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfr@bmx-chemnitz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).