33 lines
896 B
Diff
33 lines
896 B
Diff
|
From 7b4eda3369d937763f7076ad1098916a5973bc6a Mon Sep 17 00:00:00 2001
|
||
|
From: Michal Sekletar <msekleta@redhat.com>
|
||
|
Date: Tue, 27 Aug 2024 17:59:15 +0200
|
||
|
Subject: [PATCH] Prevent icmp_socket leak on error
|
||
|
|
||
|
---
|
||
|
packet/probe_unix.c | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/packet/probe_unix.c b/packet/probe_unix.c
|
||
|
index 00ec7a2..7362d6d 100644
|
||
|
--- a/packet/probe_unix.c
|
||
|
+++ b/packet/probe_unix.c
|
||
|
@@ -296,6 +296,7 @@ int open_ip4_sockets_dgram(
|
||
|
}
|
||
|
#ifdef HAVE_LINUX_ERRQUEUE_H
|
||
|
if (setsockopt(icmp_socket, SOL_IP, IP_RECVERR, &val, sizeof(val)) < 0) {
|
||
|
+ close(icmp_socket);
|
||
|
return -1;
|
||
|
}
|
||
|
#endif
|
||
|
@@ -386,6 +387,7 @@ int open_ip6_sockets_dgram(
|
||
|
}
|
||
|
#ifdef HAVE_LINUX_ERRQUEUE_H
|
||
|
if (setsockopt(icmp_socket, SOL_IPV6, IPV6_RECVERR, &val, sizeof(val)) < 0) {
|
||
|
+ close(icmp_socket);
|
||
|
return -1;
|
||
|
}
|
||
|
#endif
|
||
|
--
|
||
|
2.39.3 (Apple Git-146)
|
||
|
|