summaryrefslogtreecommitdiff
path: root/src/dhcpv6.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-05-04 13:32:09 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-05-04 16:15:59 +0300
commit4cd19238f5499623391ebf74c74af03905a14ef8 (patch)
treef049ffe843c2974d77a345bfdaf5205668f87f0c /src/dhcpv6.c
parent4eef3f40d32a4351f65899af80c94492641a64b2 (diff)
downloadconnman-4cd19238f5499623391ebf74c74af03905a14ef8.tar.gz
connman-4cd19238f5499623391ebf74c74af03905a14ef8.tar.bz2
connman-4cd19238f5499623391ebf74c74af03905a14ef8.zip
dhcpv6: Remove timer properly in error cases
Needed so that we do not access stale pointers from timer handler.
Diffstat (limited to 'src/dhcpv6.c')
-rw-r--r--src/dhcpv6.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 5d09799a..bf764c8b 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -343,20 +343,24 @@ static int dhcpv6_info_request(struct connman_dhcpv6 *dhcp)
index = connman_network_get_index(dhcp->network);
dhcp_client = g_dhcp_client_new(G_DHCP_IPV6, index, &error);
- if (error != G_DHCP_CLIENT_ERROR_NONE)
+ if (error != G_DHCP_CLIENT_ERROR_NONE) {
+ clear_timer(dhcp);
return -EINVAL;
+ }
if (getenv("CONNMAN_DHCPV6_DEBUG"))
g_dhcp_client_set_debug(dhcp_client, dhcpv6_debug, "DHCPv6");
service = __connman_service_lookup_from_network(dhcp->network);
if (service == NULL) {
+ clear_timer(dhcp);
g_dhcp_client_unref(dhcp_client);
return -EINVAL;
}
ret = set_duid(service, dhcp->network, dhcp_client, index);
if (ret < 0) {
+ clear_timer(dhcp);
g_dhcp_client_unref(dhcp_client);
return ret;
}
@@ -1092,20 +1096,24 @@ static int dhcpv6_solicitation(struct connman_dhcpv6 *dhcp)
index = connman_network_get_index(dhcp->network);
dhcp_client = g_dhcp_client_new(G_DHCP_IPV6, index, &error);
- if (error != G_DHCP_CLIENT_ERROR_NONE)
+ if (error != G_DHCP_CLIENT_ERROR_NONE) {
+ clear_timer(dhcp);
return -EINVAL;
+ }
if (getenv("CONNMAN_DHCPV6_DEBUG"))
g_dhcp_client_set_debug(dhcp_client, dhcpv6_debug, "DHCPv6");
service = __connman_service_lookup_from_network(dhcp->network);
if (service == NULL) {
+ clear_timer(dhcp);
g_dhcp_client_unref(dhcp_client);
return -EINVAL;
}
ret = set_duid(service, dhcp->network, dhcp_client, index);
if (ret < 0) {
+ clear_timer(dhcp);
g_dhcp_client_unref(dhcp_client);
return ret;
}