ti_sci: Prevent memory leak
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 8 Oct 2025 09:23:35 +0000 (10:23 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 16 Oct 2025 21:02:14 +0000 (15:02 -0600)
commit4b8bc5af80f1637cd71a1b6a0dffa7588a03f27c
treecb375801cad9518a3843afe2c86c3392ab752823
parenta157a73720e242f4e16c81e64d36be9d284d2028
ti_sci: Prevent memory leak

temp is assigned the pointer returned by malloc which is used without a
NULL check and then never freed. Add a NULL check and ensure temp is
freed on all return paths.

This issue was found by Smatch.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: Anshul Dalal <anshuld@ti.com>
drivers/firmware/ti_sci.c