aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-28 21:24:17 -0500
committerIan Moffett <ian@osmora.org>2024-02-28 21:27:05 -0500
commit26bc325d72632bf7995223910fa83c8f40af08c8 (patch)
treec99a18f35c51b0494d2854ca0e8320e8bc46951e
parentffb562a02b11ca3e879cc5ed3da2e0d3ffacb6e9 (diff)
kernel: vfs: Do not leak memory
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/kern/vfs_subr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 04b644e..27f10ee 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -77,11 +77,13 @@ vfs_hash_path(const char *path)
return 0;
}
- do {
+ while (name != NULL) {
name = vfs_get_fname_at(path, i++);
- if (name != NULL)
+ if (name != NULL) {
hash += vfs_hash(name);
- } while (name != NULL);
+ dynfree(name);
+ }
+ }
return hash;
}
@@ -185,6 +187,7 @@ vfs_mount(struct mount **mp_out, const char *path, int mnt_flags)
cache_status = vfs_cache_mp(mp, path);
if (cache_status != 0) {
+ dynfree(mp);
return cache_status;
}