[PATCH 6/7] globalvar: fix memory leak
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri May 17 00:48:23 PDT 2024
val is copied and then goes out of scope, thereby leaking the buffer it
points at. Free it before that happens.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/globalvar.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/globalvar.c b/common/globalvar.c
index a83529f98fe0..79624adcfe6f 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -370,6 +370,7 @@ int nvvar_load(void)
if (ret)
pr_err("failed to create nv variable %s: %s\n",
n, strerror(-ret));
+ free(val);
}
closedir(dir);
--
2.39.2
More information about the barebox
mailing list