Input: psmouse - fix input_dev leak in lifebook driver
authorAndres Salomon <dilinger@queued.net>
Thu, 17 Jan 2008 17:01:51 +0000 (12:01 -0500)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 17 Jan 2008 17:01:51 +0000 (12:01 -0500)
The lifebook driver may register a second input device, but it never
unregisters it.  This fixes that.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/mouse/lifebook.c

index 9ec57d80186e43b7f776ec3b9aed0c7c385ce625..df81b0aaa9f88911fa335d506f284161c5e24d70 100644 (file)
@@ -225,8 +225,13 @@ static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolu
 
 static void lifebook_disconnect(struct psmouse *psmouse)
 {
+       struct lifebook_data *priv = psmouse->private;
+
        psmouse_reset(psmouse);
-       kfree(psmouse->private);
+       if (priv) {
+               input_unregister_device(priv->dev2);
+               kfree(priv);
+       }
        psmouse->private = NULL;
 }