serial: sunsu: Free memory when probe fails
authorSouptick Joarder <jrdr.linux@gmail.com>
Mon, 14 Nov 2016 12:14:49 +0000 (17:44 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2016 09:57:26 +0000 (10:57 +0100)
When su_probe() fails it doesn't free *up and we may have a memory
leak. Fix this by freeing *up before return.

Signed-off-by: Souptick joarder <jrdr.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sunsu.c

index 9ad98ea..72df2e1 100644 (file)
@@ -1500,6 +1500,7 @@ static int su_probe(struct platform_device *op)
 
 out_unmap:
        of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
+       kfree(up);
        return err;
 }