Skip to contentSkip to conversation

iplink: Fix descriptor leak in get_link_kind()

PATCH In review Maks Mishin 2 participants 2 messages Feb 7, 2024 – Feb 8, 2024

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

PATCH 1/1 iplink: Fix descriptor leak in get_link_kind()

Found by RASU JSC

---
 ip/iplink.c | 3 +++
 1 file changed, 3 insertions(+)
ip/iplink.c +3 -0
index 95314af5..7e31b95c 100644
@@ -168,6 +168,9 @@ struct link_util *get_link_kind(const char *id)
 
 	snprintf(buf, sizeof(buf), "%s_link_util", id);
 	l = dlsym(dlh, buf);
+	if (dlh != NULL)
+		dlclose(dlh);
+
 	if (l == NULL)
 		return NULL;
 
Signature · 1 line
2.30.2
#1 lore raw
Quoted 12 lines · On Thu, 8 Feb 2024 00:04:50 +0300 Maks Mishin <[email protected]> wrote:

Found by RASU JSC

---
 ip/iplink.c | 3 +++
 1 file changed, 3 insertions(+)
ip/iplink.c +0 -0
index 95314af5..7e31b95c 100644

ip/iplink.c struct link_util *get_link_kind(const char *id) · line 176

Quoted 9 lines
ip/iplink.c +3 -0
@@ -168,6 +168,9 @@ struct link_util *get_link_kind(const char *id)
 
 	snprintf(buf, sizeof(buf), "%s_link_util", id);
 	l = dlsym(dlh, buf);
+	if (dlh != NULL)
+		dlclose(dlh);
+
 	if (l == NULL)
 		return NULL;
 

NAK this will break the caching of BODY.