Skip to contentSkip to conversation

tc: Fix descriptor leak in get_filter_kind()

PATCH New Maks Mishin 1 participant 1 message Feb 7, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: Fix descriptor leak in get_filter_kind()

Add closure of fd dlh.

Found by RASU JSC

---
 tc/tc.c | 3 +++
 1 file changed, 3 insertions(+)
tc/tc.c +3 -0
index 575157a8..4f89719c 100644
@@ -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;
 
Signature · 1 line
2.30.2