summaryrefslogtreecommitdiffstats
path: root/drivers/char/ppdev.c
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2016-11-10 23:11:59 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-29 20:25:34 +0100
commit2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5 (patch)
tree911516ca1d0a07f183893ab4c0f29a3cf8827efc /drivers/char/ppdev.c
parentmei: me: add lewisburg device ids (diff)
downloadlinux-2bd362d5f45c17f3a41b3ab04e71508ffd3f48c5.tar.xz
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.c2
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;
}