ANDROID: input: keychord: Fix for a memory leak in keychord.
authorMohan Srinivasan <srmohan@google.com>
Wed, 9 Aug 2017 19:36:33 +0000 (12:36 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
Fixes a steady memory leak in the keychord release code. A close of
the keychord device will leak 1 keychord structure. Easily
reproducible by a simple program that does an open()->write()->close()
of the keychord device.

Bug: 64483974
Change-Id: I1fa402c666cffb00b8cfd6379d9fe47a0989152c
Signed-off-by: Mohan Srinivasan <srmohan@google.com>
drivers/input/misc/keychord.c

index afff15f5c2e01dd9e1ce068fbb93f53e56d76adb..b09ecf743635f0ae4b96fb4e9fb42e46619821aa 100644 (file)
@@ -432,6 +432,7 @@ static int keychord_release(struct inode *inode, struct file *file)
 
        if (kdev->registered)
                input_unregister_handler(&kdev->input_handler);
+       kfree(kdev->keychords);
        kfree(kdev);
 
        return 0;