[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1478815921-25718-1-git-send-email-sudipm.mukherjee@gmail.com>
Date: Thu, 10 Nov 2016 22:11:59 +0000
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH 1/3] 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@...db.de>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
---
drivers/char/ppdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 6af1ce0..f08f3ed 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;
}
--
1.9.1
Powered by blists - more mailing lists