aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-01-17 12:01:30 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-01-17 12:01:30 -0500
commit746b31a9d4e08240d267069bcf5084eb7e427ad7 (patch)
tree34abba83caf7dde6c22dc13bf26e0ee11e136b41
parent62aa366d9b0158a81eace3b83e6b027789f7575b (diff)
Input: psmouse - fix potential memory leak in psmouse_connect()
If we successfully call input_register_device() in psmouse_connect() but sysfs_create_group() fails, we'll enter the error path without ever having called input_unregister_device() potentially leaking memory. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/mouse/psmouse-base.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 21a9c0b69a1f..b8628252e10c 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
1247 err_pt_deactivate: 1247 err_pt_deactivate:
1248 if (parent && parent->pt_deactivate) 1248 if (parent && parent->pt_deactivate)
1249 parent->pt_deactivate(parent); 1249 parent->pt_deactivate(parent);
1250 input_unregister_device(psmouse->dev);
1251 input_dev = NULL; /* so we don't try to free it below */
1250 err_protocol_disconnect: 1252 err_protocol_disconnect:
1251 if (psmouse->disconnect) 1253 if (psmouse->disconnect)
1252 psmouse->disconnect(psmouse); 1254 psmouse->disconnect(psmouse);