net: phy: cortina: Ensure memory allocated is freed
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 5 Aug 2025 16:10:26 +0000 (17:10 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 15 Aug 2025 18:59:50 +0000 (12:59 -0600)
commit145a6f447e47f679218f8886c06622b19f4e22a6
tree9a9ca090355b18add99c4c8ac8583c687f94497e
parentc39a8001ca862fbb676ddb788bc86f22c243bb88
net: phy: cortina: Ensure memory allocated is freed

In cs4340_upload_firmware a buffer is allocated with malloc but this is
never freed. The pointer to this buffer, addr, is not even kept
unchanged. But in some cases addr is not a buffer allocated by malloc.
Introduce the use of another pointer to keep track of the buffer and to
know if it needs to be freed.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/net/phy/cortina.c