openwrt-packages/utils/conmon/patches/100-fix-null-socket-connect...

23 lines
519 B
Diff

--- a/src/conn_sock.c
+++ b/src/conn_sock.c
@@ -465,6 +465,9 @@ static void init_remote_sock(struct remo
static void close_sock(gpointer data, G_GNUC_UNUSED gpointer user_data)
{
+ if (data == NULL)
+ return;
+
struct remote_sock_s *sock = (struct remote_sock_s *)data;
close(sock->fd);
@@ -473,5 +476,9 @@ static void close_sock(gpointer data, G_
void close_all_readers()
{
+
+ if (local_mainfd_stdin.readers == NULL)
+ return;
+
g_ptr_array_foreach(local_mainfd_stdin.readers, close_sock, NULL);
}