[PATCH 7/7] power: reset: reboot-mode: fix memory leak

Ahmad Fatoum a.fatoum at pengutronix.de
Fri May 17 00:48:24 PDT 2024


magicbuf is only used for comparisons and debug output in
reboot_mode_register() and is then leaked after its return.

Free it instead once no longer needed.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/power/reset/nvmem-reboot-mode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index 1a9422800ef7..446951dd77c7 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -71,6 +71,8 @@ static int nvmem_reboot_mode_probe(struct device *dev)
 	if (ret)
 		dev_err(dev, "can't register reboot mode\n");
 
+	free(magicbuf);
+
 	return ret;
 }
 
-- 
2.39.2




More information about the barebox mailing list