summaryrefslogtreecommitdiff
path: root/src/inet.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2012-02-29 05:20:24 -0300
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-03-01 13:45:25 +0100
commite6c7386e8e25a1857673903efea54f89bcbf1b7a (patch)
tree90eb313aeaed6131cc9472d5a7d845f8f1f11aa4 /src/inet.c
parente22e1747723cbd9f835f2bdb903f2372f0bdd486 (diff)
downloadconnman-e6c7386e8e25a1857673903efea54f89bcbf1b7a.tar.gz
connman-e6c7386e8e25a1857673903efea54f89bcbf1b7a.tar.bz2
connman-e6c7386e8e25a1857673903efea54f89bcbf1b7a.zip
inet: Ensure data->channel exist before accessing it
Log of segfault: ... connmand[676]: src/network.c:check_dhcpv6() reply (nil) connmand[676]: src/network.c:check_dhcpv6() re-send router solicitation 3 connmand[676]: src/inet.c:__connman_inet_ipv6_send_rs() connmand[676]: Aborting (signal 11) [connmand]
Diffstat (limited to 'src/inet.c')
-rw-r--r--src/inet.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/inet.c b/src/inet.c
index d9e12a9b..220ea143 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -1433,9 +1433,11 @@ static const struct in6_addr in6addr_all_routers_mc =
static void rs_cleanup(struct rs_cb_data *data)
{
- g_io_channel_shutdown(data->channel, TRUE, NULL);
- g_io_channel_unref(data->channel);
- data->channel = 0;
+ if (data->channel != NULL) {
+ g_io_channel_shutdown(data->channel, TRUE, NULL);
+ g_io_channel_unref(data->channel);
+ data->channel = NULL;
+ }
if (data->rs_timeout > 0)
g_source_remove(data->rs_timeout);