Skip to content

Commit

Permalink
ppdev: fix memory leak
Browse files Browse the repository at this point in the history
The variable name was only released if parport_register_dev_model()
fails. Now that we are using the device-model the parport driver
will duplicate the name and use it. So we can release the variable
after the device has been registered with the parport.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sudip Mukherjee authored and Greg Kroah-Hartman committed Nov 29, 2016
1 parent 9ff2007 commit 2bd362d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/ppdev.c
Original file line number Diff line number Diff line change
@@ -305,10 +305,10 @@ static int register_device(int minor, struct pp_struct *pp)
ppdev_cb.private = pp;
pdev = parport_register_dev_model(port, name, &ppdev_cb, minor);
parport_put_port(port);
kfree(name);

if (!pdev) {
printk(KERN_WARNING "%s: failed to register device!\n", name);
kfree(name);
return -ENXIO;
}

0 comments on commit 2bd362d

Please sign in to comment.