[PATCH 6/7] globalvar: fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux