Commit 3ca96941 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

hwmon: (ibmaem) add missing kfree

commit 66a89b21 upstream.

rs_resp is dynamically allocated in aem_read_sensor(), so it should be freed
before exiting in every case.  This collects the kfree and the return at
the end of the function.
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ae2690d0
...@@ -429,13 +429,15 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, ...@@ -429,13 +429,15 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
aem_send_message(ipmi); aem_send_message(ipmi);
res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT);
if (!res) if (!res) {
return -ETIMEDOUT; res = -ETIMEDOUT;
goto out;
}
if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || if (ipmi->rx_result || ipmi->rx_msg_len != rs_size ||
memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) {
kfree(rs_resp); res = -ENOENT;
return -ENOENT; goto out;
} }
switch (size) { switch (size) {
...@@ -460,8 +462,11 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, ...@@ -460,8 +462,11 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
break; break;
} }
} }
res = 0;
return 0; out:
kfree(rs_resp);
return res;
} }
/* Update AEM energy registers */ /* Update AEM energy registers */
......
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