DORMANTno replies

[PATCH] tc: Fix descriptor leak in get_filter_kind()

From: Maks Mishin <hidden>
Date: 2024-02-07 21:01:09
Subsystem: the rest · Maintainer: Linus Torvalds

Add closure of fd `dlh`.

Found by RASU JSC

Signed-off-by: Maks Mishin <redacted>
---
 tc/tc.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/tc/tc.c b/tc/tc.c
index 575157a8..4f89719c 100644
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -167,6 +167,9 @@ struct filter_util *get_filter_kind(const char *str)
 
 	snprintf(buf, sizeof(buf), "%s_filter_util", str);
 	q = dlsym(dlh, buf);
+	if (dlh != NULL)
+		dlclose(dlh);
+
 	if (q == NULL)
 		goto noexist;
 
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help