[PATCH] HID, hid-picolcd: Fix memory leak inpicolcd_debug_out_report()
From: Jesper Juhl
Date: Sun Jan 02 2011 - 16:17:19 EST
Hi,
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@xxxxxxxxxxxxx>
---
hid-picolcd.c | 1 +
1 file changed, 1 insertion(+)
compile tested only.
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index bc2e077..ad6539a 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,
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 {
--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/