From f795e365ecca6781cc99bd634f7a7e05bef1de95 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 26 Apr 2013 15:51:16 +0300 Subject: [PATCH] dnsproxy: Do not unref g_io_channel if we know it is null Currently tethering does not support IPv6 so its listener is not created and is null. This will cause following output connmand[18363]: src/dnsproxy.c:destroy_tcp_listener() index 31 (connmand:18363): GLib-CRITICAL **: g_io_channel_unref: assertion `channel != NULL' failed connmand[18363]: src/dnsproxy.c:destroy_udp_listener() index 31 (connmand:18363): GLib-CRITICAL **: g_io_channel_unref: assertion `channel != NULL' failed --- src/dnsproxy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 4ad4eb6..9030a35 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -3345,8 +3345,10 @@ static void destroy_udp_listener(struct listener_data *ifdata) if (ifdata->udp6_listener_watch > 0) g_source_remove(ifdata->udp6_listener_watch); - g_io_channel_unref(ifdata->udp4_listener_channel); - g_io_channel_unref(ifdata->udp6_listener_channel); + if (ifdata->udp4_listener_channel != NULL) + g_io_channel_unref(ifdata->udp4_listener_channel); + if (ifdata->udp6_listener_channel != NULL) + g_io_channel_unref(ifdata->udp6_listener_channel); } static void destroy_tcp_listener(struct listener_data *ifdata) @@ -3358,8 +3360,10 @@ static void destroy_tcp_listener(struct listener_data *ifdata) if (ifdata->tcp6_listener_watch > 0) g_source_remove(ifdata->tcp6_listener_watch); - g_io_channel_unref(ifdata->tcp4_listener_channel); - g_io_channel_unref(ifdata->tcp6_listener_channel); + if (ifdata->tcp4_listener_channel != NULL) + g_io_channel_unref(ifdata->tcp4_listener_channel); + if (ifdata->tcp6_listener_channel != NULL) + g_io_channel_unref(ifdata->tcp6_listener_channel); } static int create_listener(struct listener_data *ifdata) -- 2.7.4