Skip to content

Commit a78eb69

Browse files
Abdun NihaalJiri Kosina
authored andcommitted
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: a251d65 ("HID: uclogic: Handle wireless device reconnection") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 8513c15 commit a78eb69

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/hid/hid-uclogic-params.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,8 +1369,10 @@ static int uclogic_params_ugee_v2_init_event_hooks(struct hid_device *hdev,
13691369
event_hook->hdev = hdev;
13701370
event_hook->size = ARRAY_SIZE(reconnect_event);
13711371
event_hook->event = kmemdup(reconnect_event, event_hook->size, GFP_KERNEL);
1372-
if (!event_hook->event)
1372+
if (!event_hook->event) {
1373+
kfree(event_hook);
13731374
return -ENOMEM;
1375+
}
13741376

13751377
list_add_tail(&event_hook->list, &p->event_hooks->list);
13761378

0 commit comments

Comments
 (0)