From: Jukka Rissanen Date: Fri, 26 Apr 2013 12:51:16 +0000 (+0300) Subject: dnsproxy: Do not unref g_io_channel if we know it is null X-Git-Tag: 1.14~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f795e365ecca6781cc99bd634f7a7e05bef1de95;p=platform%2Fupstream%2Fconnman.git 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 --- 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)