aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2009-06-26 04:50:12 -0400
committerJiri Kosina <jkosina@suse.cz>2009-06-26 04:50:12 -0400
commit55dba52458a11126ff4445b5b94ebde03afcf47a (patch)
tree29f75f735c3c5ee6cfdd73bbf9f3c7d39e426a9e /drivers/hid
parent38b7f49a0654cb52cac61c6455807248eee3059d (diff)
HID: fix memory leak on error path in debug code
If hid_get_report() fails, we forgot to free the already allocated buffer for debugging messages on error path. Fix that up. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 449bd747d116..86c2ff2429d8 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1100,8 +1100,10 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
1100 hid_debug_event(hid, buf); 1100 hid_debug_event(hid, buf);
1101 1101
1102 report = hid_get_report(report_enum, data); 1102 report = hid_get_report(report_enum, data);
1103 if (!report) 1103 if (!report) {
1104 kfree(buf);
1104 return -1; 1105 return -1;
1106 }
1105 1107
1106 /* dump the report */ 1108 /* dump the report */
1107 snprintf(buf, HID_DEBUG_BUFSIZE - 1, 1109 snprintf(buf, HID_DEBUG_BUFSIZE - 1,