tools: env: Fix missing closedir in ubi_get_volnum_by_name
The function calls opendir() but missing the corresponding
closedir() before exit the function.
Add missing closedir() to fix it.
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 908a162..c251e2e 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -192,10 +192,13 @@
&tmp_devnum, &volnum);
if (ret == 2 && devnum == tmp_devnum) {
if (ubi_check_volume_sysfs_name(dirent->d_name,
- volname) == 0)
+ volname) == 0) {
+ closedir(sysfs_ubi);
return volnum;
+ }
}
}
+ closedir(sysfs_ubi);
return -1;
}