Input: ALPS - fix memory leak when detection fails
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 27 Feb 2015 23:49:51 +0000 (15:49 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 4 Mar 2015 23:17:08 +0000 (15:17 -0800)
This fixes memory leak introduced by commit
a09221e83e13e09a33109b9b037484eade901cea

Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/alps.c

index d28726a0ef858e252948d2e5f2fd009bfd6c5506..1bd15ebc01f2df5002eca38f7089a61701471f5d 100644 (file)
@@ -2605,8 +2605,10 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
                return -ENOMEM;
 
        error = alps_identify(psmouse, priv);
-       if (error)
+       if (error) {
+               kfree(priv);
                return error;
+       }
 
        if (set_properties) {
                psmouse->vendor = "ALPS";