Thread (6 messages) flat view 6 messages, 2 authors, 2020-04-01
STALE2359d

[PATCH v4 4/4] Input: adp5589: fix possible memleak of 'kpad'

From: Alexandru Ardelean <hidden>
Date: 2020-03-05 13:11:36
Also in: lkml
Subsystem: input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Dmitry Torokhov, Linus Torvalds

If 'adp5589_i2c_get_driver_data()' returns an error, the exit path should
be to also free the 'kpad' object.
This change fixes that.

Reported-by: kbuild test robot <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Alexandru Ardelean <redacted>
---
 drivers/input/keyboard/adp5589-keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 1fd36c581a91..5cef5a13b776 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -1050,7 +1050,7 @@ static int adp5589_probe(struct i2c_client *client,
 
 	ret = adp5589_i2c_get_driver_data(client, id);
 	if (ret < 0)
-		return ret;
+		goto err_free_mem;
 
 	switch (ret) {
 	case ADP5585_02:
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help