[PATCH] serial: core: Release memory obtained by kasprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Free memory region, if uart_add_one_port is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
 drivers/tty/serial/serial_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 3a14ccc..989adbb 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2784,7 +2784,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
 				    GFP_KERNEL);
 	if (!uport->tty_groups) {
 		ret = -ENOMEM;
-		goto out;
+		goto out1;
 	}
 	uport->tty_groups[0] = &tty_dev_attr_group;
 	if (uport->attr_group)
@@ -2808,6 +2808,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
 	 */
 	uport->flags &= ~UPF_DEAD;
 
+ out1:
+	kfree(uport->name);
  out:
 	mutex_unlock(&port->mutex);
 	mutex_unlock(&port_mutex);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux