aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiaoqian Lin2022-09-19 08:28:09 +0400
committerTom Rini2022-09-29 10:10:39 -0400
commit316590db29b484209dbc3c3d60561168d0f7263c (patch)
tree29a5d599a2e2686d799c44f49bcb1406a59a3d2a
parentd2ab2a2bafd53ace79da900900d5220931c7ef5a (diff)
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>
-rw-r--r--tools/env/fw_env.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 908a162202d..c251e2e6ba7 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -192,10 +192,13 @@ static int ubi_get_volnum_by_name(int devnum, const char *volname)
&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;
}