Commit 746b31a9 authored by Andres Salomon's avatar Andres Salomon Committed by Dmitry Torokhov

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: default avatarAndres Salomon <dilinger@debian.org>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 62aa366d
...@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv) ...@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
err_pt_deactivate: err_pt_deactivate:
if (parent && parent->pt_deactivate) if (parent && parent->pt_deactivate)
parent->pt_deactivate(parent); parent->pt_deactivate(parent);
input_unregister_device(psmouse->dev);
input_dev = NULL; /* so we don't try to free it below */
err_protocol_disconnect: err_protocol_disconnect:
if (psmouse->disconnect) if (psmouse->disconnect)
psmouse->disconnect(psmouse); psmouse->disconnect(psmouse);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment