Besides the IO channel for routing events, the associated watch also
needs to be cleaned up on exit.
---
src/rtnl.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/rtnl.c b/src/rtnl.c
index a46aa28..e03a390 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -1291,6 +1291,7 @@ static const char *type2string(uint16_t type)
}
static GIOChannel *channel = NULL;
+static guint channel_watch = 0;
struct rtnl_request {
struct nlmsghdr hdr;
@@ -1621,8 +1622,9 @@ int __connman_rtnl_init(void)
g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, FALSE);
- g_io_add_watch(channel, G_IO_IN | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
- netlink_event, NULL);
+ channel_watch = g_io_add_watch(channel,
+ G_IO_IN | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
+ netlink_event, NULL);
return 0;
}
@@ -1672,6 +1674,11 @@ void __connman_rtnl_cleanup(void)
g_slist_free(request_list);
request_list = NULL;
+ if (channel_watch) {
+ g_source_remove(channel_watch);
+ channel_watch = 0;
+ }
+
g_io_channel_shutdown(channel, TRUE, NULL);
g_io_channel_unref(channel);
--
1.9.1
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman