Skip to content

Commit

Permalink
Input: psmouse - fix potential memory leak in psmouse_connect()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andres Salomon authored and Dmitry Torokhov committed Jan 17, 2008
1 parent 62aa366 commit 746b31a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/input/mouse/psmouse-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
err_pt_deactivate:
if (parent && parent->pt_deactivate)
parent->pt_deactivate(parent);
input_unregister_device(psmouse->dev);
input_dev = NULL; /* so we don't try to free it below */
err_protocol_disconnect:
if (psmouse->disconnect)
psmouse->disconnect(psmouse);
Expand Down

0 comments on commit 746b31a

Please sign in to comment.