Skip to content

Commit

Permalink
serial: sunhv: Free memory when remove() is called
Browse files Browse the repository at this point in the history
In each call to hv_remove(), con_read_page and con_write_page is not
getting freed and lead to memory leakage. Fix this by freeing both
pointers in hv_remove().

Signed-off-by: Souptick joarder <jrdr.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Souptick Joarder authored and Greg Kroah-Hartman committed Nov 16, 2016
1 parent 31b5929 commit fbb7d2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/tty/serial/sunhv.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ static int hv_remove(struct platform_device *dev)
uart_remove_one_port(&sunhv_reg, port);

sunserial_unregister_minors(&sunhv_reg, 1);

kfree(con_read_page);
kfree(con_write_page);
kfree(port);
sunhv_port = NULL;

Expand Down

0 comments on commit fbb7d2e

Please sign in to comment.