[PATCH] serial: jsm: Free memory when jsm_tty_open() fails

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

 



When jsm_tty_open() fails it doesn't free allocated memory and we may have a memory
leak. Fix this by freeing the allocated memory before the return.

Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx>
---
 drivers/tty/serial/jsm/jsm_tty.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index ec7d838..a5b88fc 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -224,6 +224,7 @@ static int jsm_tty_open(struct uart_port *port)
 		if (!channel->ch_equeue) {
 			jsm_dbg(INIT, &channel->ch_bd->pci_dev,
 				"unable to allocate error queue buf\n");
+			kfree(channel->ch_rqueue);
 			return -ENOMEM;
 		}
 	}
--
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