diff options
| author | Abdun Nihaal <nihaal@cse.iitm.ac.in> | 2025-11-10 22:59:41 +0530 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2025-11-18 18:08:20 +0100 |
| commit | a78eb69d60ce893de48dd75f725ba21309131fc2 (patch) | |
| tree | 947cda31a703d54a547e9b52edde47cbb9601c94 | |
| parent | 8513c154f8ad7097653dd9bf43d6155e5aad4ab3 (diff) | |
HID: uclogic: Fix potential memory leak in error path
In uclogic_params_ugee_v2_init_event_hooks(), the memory allocated for
event_hook is not freed in the next error path. Fix that by freeing it.
Fixes: a251d6576d2a ("HID: uclogic: Handle wireless device reconnection")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
| -rw-r--r-- | drivers/hid/hid-uclogic-params.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index ffa14a4621ef..4c4bac6f792b 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1369,8 +1369,10 @@ static int uclogic_params_ugee_v2_init_event_hooks(struct hid_device *hdev, event_hook->hdev = hdev; event_hook->size = ARRAY_SIZE(reconnect_event); event_hook->event = kmemdup(reconnect_event, event_hook->size, GFP_KERNEL); - if (!event_hook->event) + if (!event_hook->event) { + kfree(event_hook); return -ENOMEM; + } list_add_tail(&event_hook->list, &p->event_hooks->list); |