diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2016-11-10 22:11:59 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-29 20:25:34 +0100 |
commit | 2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5 (patch) | |
tree | 911516ca1d0a07f183893ab4c0f29a3cf8827efc /drivers/char/ppdev.c | |
parent | 9ff2007bea1f1bfc53ac0bc7ccf8200bb275fd52 (diff) | |
download | linux-2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5.tar.gz linux-2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5.tar.bz2 linux-2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5.zip |
ppdev: fix memory leak
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>
Diffstat (limited to 'drivers/char/ppdev.c')
-rw-r--r-- | drivers/char/ppdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 6af1ce04b3da..f08f3ed98e01 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -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; } |