Commit ca5432a7 authored by Max Kellermann's avatar Max Kellermann

listen: remove the socket source from the main context

Free memory before exiting.
parent d60cf67d
......@@ -58,6 +58,8 @@ struct listen_socket {
struct listen_socket *next;
int fd;
guint source_id;
};
static struct listen_socket *listen_sockets;
......@@ -101,8 +103,8 @@ static int establishListen(int pf, const struct sockaddr *addrp,
ls->fd = sock;
channel = g_io_channel_unix_new(sock);
g_io_add_watch(channel, G_IO_IN,
listen_in_event, GINT_TO_POINTER(sock));
ls->source_id = g_io_add_watch(channel, G_IO_IN,
listen_in_event, GINT_TO_POINTER(sock));
g_io_channel_unref(channel);
ls->next = listen_sockets;
......@@ -281,6 +283,7 @@ void closeAllListenSockets(void)
struct listen_socket *ls = listen_sockets;
listen_sockets = ls->next;
g_source_remove(ls->source_id);
close(ls->fd);
g_free(ls);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment