Skip to contentSkip to conversation

thermal: core: add the misse nlmsg_free() for thermal_genl_sampling_temp()

PATCH New Jing Xiangfeng 1 participant 1 message Sep 29, 2020 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: core: add the misse nlmsg_free() for thermal_genl_sampling_temp()

thermal_genl_sampling_temp() misses to call nlmsg_free() in an error path. Jump to out_free to fix it.

---
 drivers/thermal/thermal_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/thermal_netlink.c +2 -1
index af7b2383e8f6..019f4812def6 100644
@@ -78,7 +78,7 @@ int thermal_genl_sampling_temp(int id, int temp)
 	hdr = genlmsg_put(skb, 0, 0, &thermal_gnl_family, 0,
 			  THERMAL_GENL_SAMPLING_TEMP);
 	if (!hdr)
-		return -EMSGSIZE;
+		goto out_free;
 
 	if (nla_put_u32(skb, THERMAL_GENL_ATTR_TZ_ID, id))
 		goto out_cancel;
@@ -93,6 +93,7 @@ int thermal_genl_sampling_temp(int id, int temp)
 	return 0;
 out_cancel:
 	genlmsg_cancel(skb, hdr);
+out_free:
 	nlmsg_free(skb);
 
 	return -EMSGSIZE;
Signature · 1 line
2.26.0.106.g9fadedd