diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-01-02 16:17:00 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-01-02 18:11:30 -0500 |
commit | 0fbf8ed976af5bb43cf9cf2492161eb9688fee0c (patch) | |
tree | 186b2986bcbbbf97f49b1e2385880b84df9fd7d2 /drivers/hid/hid-picolcd.c | |
parent | 86280a208825d55ba988420b6b0ed2d6b9ec80f8 (diff) |
HID: hid-picolcd: Fix memory leak in picolcd_debug_out_report()
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>
Diffstat (limited to 'drivers/hid/hid-picolcd.c')
-rw-r--r-- | drivers/hid/hid-picolcd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 0aff3cdddd83..abd0bdc84624 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -1867,6 +1867,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data, | |||
1867 | report->id, raw_size); | 1867 | report->id, raw_size); |
1868 | hid_debug_event(hdev, buff); | 1868 | hid_debug_event(hdev, buff); |
1869 | if (raw_size + 5 > sizeof(raw_data)) { | 1869 | if (raw_size + 5 > sizeof(raw_data)) { |
1870 | kfree(buff); | ||
1870 | hid_debug_event(hdev, " TOO BIG\n"); | 1871 | hid_debug_event(hdev, " TOO BIG\n"); |
1871 | return; | 1872 | return; |
1872 | } else { | 1873 | } else { |