Skip to content

Commit

Permalink
HID: hid-picolcd: Fix memory leak in picolcd_debug_out_report()
Browse files Browse the repository at this point in the history
We have a memory leak in drivers/hid/hid-picolcd.c::picolcd_debug_out_report()
in an error path..  We are not always freeing the memory allocated to
'buff' - this patch makes sure we always kfree() what we allocate with
kmalloc() when it is no longer needed.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jesper Juhl authored and Jiri Kosina committed Jan 2, 2011
1 parent 86280a2 commit 0fbf8ed
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/hid/hid-picolcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data,
report->id, raw_size);
hid_debug_event(hdev, buff);
if (raw_size + 5 > sizeof(raw_data)) {
kfree(buff);
hid_debug_event(hdev, " TOO BIG\n");
return;
} else {
Expand Down

0 comments on commit 0fbf8ed

Please sign in to comment.