HID: sensor-hub: fix potential memory leak
authorJiri Slaby <jslaby@suse.cz>
Mon, 30 Jun 2014 09:34:48 +0000 (11:34 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 30 Jun 2014 11:21:50 +0000 (13:21 +0200)
commitceec634076b91bea57107541a46e92d765c69488
treee957f71a87e2a28319ef6a63a80489da87e1993d
parent66e5482752386786c4346f4f4b214b0998639702
HID: sensor-hub: fix potential memory leak

hsdev is not freed in sensor_hub_probe when kasprintf inside the for
loop fails. This is because hsdev is not set to platform_data yet (to
be freed by the code in the err_no_mem label). So free the memory
explicitly in the 'if' branch, as this is the only place where this is
(and will) be needed.

Reported-by: coverity
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sensor-hub.c