[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1101022212030.11481@swampdragon.chaosbits.net>
Date: Sun, 2 Jan 2011 22:17:00 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: linux-input@...r.kernel.org
cc: Jiri Kosina <jkosina@...e.cz>, linux-kernel@...r.kernel.org,
Bruno Prémont <bonbons@...ux-vserver.org>,
"Rick L. Vinyard, Jr." <rvinyard@...nmsu.edu>
Subject: [PATCH] HID, hid-picolcd: Fix memory leak in
picolcd_debug_out_report()
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@...osbits.net>
---
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@...osbits.net> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists