All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: env: Fix missing closedir in ubi_get_volnum_by_name
@ 2022-09-19  4:28 Miaoqian Lin
  2022-09-29 20:07 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-09-19  4:28 UTC (permalink / raw)
  To: Miaoqian Lin, u-boot

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>
---
 tools/env/fw_env.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2a61a5d6f049..eb138accdcbe 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;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools: env: Fix missing closedir in ubi_get_volnum_by_name
  2022-09-19  4:28 [PATCH] tools: env: Fix missing closedir in ubi_get_volnum_by_name Miaoqian Lin
@ 2022-09-29 20:07 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2022-09-29 20:07 UTC (permalink / raw)
  To: Miaoqian Lin; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

On Mon, Sep 19, 2022 at 08:28:09AM +0400, Miaoqian Lin wrote:

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

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-29 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  4:28 [PATCH] tools: env: Fix missing closedir in ubi_get_volnum_by_name Miaoqian Lin
2022-09-29 20:07 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.