[PATCH] fs: Fix memory leak in mount()
Sascha Hauer
s.hauer at pengutronix.de
Fri Jan 26 11:42:27 PST 2018
"path" is allocated by normalise_path() and thus must be
freed. This was done in the error path, but not in the success
path.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/fs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/fs.c b/fs/fs.c
index 6f15e93ba9..7d0d97906d 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1392,6 +1392,8 @@ int mount(const char *device, const char *fsname, const char *_path,
fsdev_set_linux_rootarg(fsdev, str);
}
+ free(path);
+
return 0;
err_no_driver:
--
2.15.1
More information about the barebox
mailing list