HID: fix possible double-free on error path in hid parser

Freeing of device->collection is properly done in hid_free_device() (as
this function is supposed to free all the device resources and could be
called from transport specific code, e.g. usb_hid_configure()).

Remove all kfree() calls preceeding the hid_free_device() call.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

-5
-5
drivers/hid/hid-core.c
··· 667 667 668 668 if (item.format != HID_ITEM_FORMAT_SHORT) { 669 669 dbg("unexpected long global item"); 670 - kfree(device->collection); 671 670 hid_free_device(device); 672 671 kfree(parser); 673 672 return NULL; ··· 675 676 if (dispatch_type[item.type](parser, &item)) { 676 677 dbg("item %u %u %u %u parsing failed\n", 677 678 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 678 - kfree(device->collection); 679 679 hid_free_device(device); 680 680 kfree(parser); 681 681 return NULL; ··· 683 685 if (start == end) { 684 686 if (parser->collection_stack_ptr) { 685 687 dbg("unbalanced collection at end of report description"); 686 - kfree(device->collection); 687 688 hid_free_device(device); 688 689 kfree(parser); 689 690 return NULL; 690 691 } 691 692 if (parser->local.delimiter_depth) { 692 693 dbg("unbalanced delimiter at end of report description"); 693 - kfree(device->collection); 694 694 hid_free_device(device); 695 695 kfree(parser); 696 696 return NULL; ··· 699 703 } 700 704 701 705 dbg("item fetching failed at offset %d\n", (int)(end - start)); 702 - kfree(device->collection); 703 706 hid_free_device(device); 704 707 kfree(parser); 705 708 return NULL;