From: Jason Gerecke Date: Tue, 14 Jul 2015 01:03:44 +0000 (-0700) Subject: HID: wacom: Properly free inputs if 'wacom_allocate_inputs' fails X-Git-Tag: omap-for-v4.3/fixes-rc1~125^2~1^12~13 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9f2d203ab42f099b32ec4580e43eb08b3e4c412;p=pandora-kernel.git HID: wacom: Properly free inputs if 'wacom_allocate_inputs' fails The 'wacom_allocate_inputs' function tries to allocate three input devices: one each for the pen, touch, and pad. The pointers that are returned by the 'wacom_allocate_input' calls are temporarily stored to local variables where they are checked to ensure they're non-null before storing them in the 'wacom_wac' structure. If an allocation fails, the 'wacom_free_inputs' function is called to reclaim the memory. Unfortunately, 'wacom_free_inputs' is called prior to the pointers being copied, so it is not actually able to free anything. This patch has the calls to 'wacom_allocate_input' store the pointer directly in the 'wacom_wac' structure where they can be freed. Also, it replaces the call to 'wacom_free_inputs' with the (more general) 'wacom_clean_inputs' and removes the no-longer-used function. [jkosina@suse.com: modify to resolve conflict with 67e123f ("Delete unnecessary checks")] Signed-off-by: Jason Gerecke Signed-off-by: Jiri Kosina --- Reading git-diff-tree failed