Commit 645a9929 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

Pull input layer bugfix from Jiri Kosina:
 "Memory leak regression fix from Benjamin Tissoires"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: multitouch: prevent memleak with the allocated name
parents b2cc9c19 5939212d
......@@ -264,9 +264,12 @@ static struct mt_class mt_classes[] = {
static void mt_free_input_name(struct hid_input *hi)
{
struct hid_device *hdev = hi->report->device;
const char *name = hi->input->name;
if (hi->input->name != hdev->name)
kfree(hi->input->name);
if (name != hdev->name) {
hi->input->name = hdev->name;
kfree(name);
}
}
static ssize_t mt_show_quirks(struct device *dev,
......@@ -1040,11 +1043,11 @@ static void mt_remove(struct hid_device *hdev)
struct hid_input *hi;
sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
hid_hw_stop(hdev);
list_for_each_entry(hi, &hdev->inputs, list)
mt_free_input_name(hi);
hid_hw_stop(hdev);
kfree(td);
hid_set_drvdata(hdev, NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment