diff mbox

HID: lenovo-tpkbd: Fix memory leak in tpkbd_remove_tp()

Message ID 1347513912.3319.1.camel@phoenix (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

axel lin Sept. 13, 2012, 5:25 a.m. UTC
We need to kfree names for led_mute and led_micmute in tpkbd_remove_tp().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/hid/hid-lenovo-tpkbd.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Bernhard Seibold Sept. 14, 2012, 9:35 a.m. UTC | #1
On Thu, 13 Sep 2012 13:25:12 +0800
Axel Lin <axel.lin@gmail.com> wrote:

> We need to kfree names for led_mute and led_micmute in
> tpkbd_remove_tp().
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Bernhard Seibold <mail@bernhard-seibold.de>

> ---
>  drivers/hid/hid-lenovo-tpkbd.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hid/hid-lenovo-tpkbd.c
> b/drivers/hid/hid-lenovo-tpkbd.c index 77d2df0..60c4e1e 100644
> --- a/drivers/hid/hid-lenovo-tpkbd.c
> +++ b/drivers/hid/hid-lenovo-tpkbd.c
> @@ -519,6 +519,8 @@ static void tpkbd_remove_tp(struct hid_device
> *hdev) led_classdev_unregister(&data_pointer->led_mute);
>  
>  	hid_set_drvdata(hdev, NULL);
> +	kfree(data_pointer->led_micmute.name);
> +	kfree(data_pointer->led_mute.name);
>  	kfree(data_pointer);
>  }
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina Sept. 17, 2012, 10:56 a.m. UTC | #2
On Fri, 14 Sep 2012, Bernhard Seibold wrote:

> On Thu, 13 Sep 2012 13:25:12 +0800
> Axel Lin <axel.lin@gmail.com> wrote:
> 
> > We need to kfree names for led_mute and led_micmute in
> > tpkbd_remove_tp().
> > 
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> 
> Acked-by: Bernhard Seibold <mail@bernhard-seibold.de>

Applied, thanks.

> > ---
> >  drivers/hid/hid-lenovo-tpkbd.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/hid/hid-lenovo-tpkbd.c
> > b/drivers/hid/hid-lenovo-tpkbd.c index 77d2df0..60c4e1e 100644
> > --- a/drivers/hid/hid-lenovo-tpkbd.c
> > +++ b/drivers/hid/hid-lenovo-tpkbd.c
> > @@ -519,6 +519,8 @@ static void tpkbd_remove_tp(struct hid_device
> > *hdev) led_classdev_unregister(&data_pointer->led_mute);
> >  
> >  	hid_set_drvdata(hdev, NULL);
> > +	kfree(data_pointer->led_micmute.name);
> > +	kfree(data_pointer->led_mute.name);
> >  	kfree(data_pointer);
> >  }
> >  
>
diff mbox

Patch

diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c
index 77d2df0..60c4e1e 100644
--- a/drivers/hid/hid-lenovo-tpkbd.c
+++ b/drivers/hid/hid-lenovo-tpkbd.c
@@ -519,6 +519,8 @@  static void tpkbd_remove_tp(struct hid_device *hdev)
 	led_classdev_unregister(&data_pointer->led_mute);
 
 	hid_set_drvdata(hdev, NULL);
+	kfree(data_pointer->led_micmute.name);
+	kfree(data_pointer->led_mute.name);
 	kfree(data_pointer);
 }