From d9f2d203ab42f099b32ec4580e43eb08b3e4c412 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Mon, 13 Jul 2015 18:03:44 -0700 Subject: [PATCH] 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-format-patch failed