service: Do not unref ipconf layer upon disconnection
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 10 Jan 2011 15:20:20 +0000 (16:20 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 10 Jan 2011 15:21:19 +0000 (16:21 +0100)
The ipconfig layer is referenced at service creation time and should
thus be unreferenced when freeing said service.

src/service.c

index 4572e59..ef2817f 100644 (file)
@@ -2228,15 +2228,8 @@ static gboolean connect_timeout(gpointer user_data)
        if (service->network != NULL)
                __connman_network_disconnect(service->network);
 
-       if (__connman_ipconfig_disable(service->ipconfig_ipv4) == 0) {
-               connman_ipconfig_unref(service->ipconfig_ipv4);
-               service->ipconfig_ipv4 = NULL;
-       }
-
-       if (__connman_ipconfig_disable(service->ipconfig_ipv6) == 0) {
-               connman_ipconfig_unref(service->ipconfig_ipv6);
-               service->ipconfig_ipv6 = NULL;
-       }
+       __connman_ipconfig_disable(service->ipconfig_ipv4);
+       __connman_ipconfig_disable(service->ipconfig_ipv6);
 
        __connman_stats_service_unregister(service);
 
@@ -3349,17 +3342,8 @@ int __connman_service_connect(struct connman_service *service)
 
        if (err < 0) {
                if (err != -EINPROGRESS) {
-                       if (__connman_ipconfig_disable(
-                                       service->ipconfig_ipv4) == 0) {
-                               connman_ipconfig_unref(service->ipconfig_ipv4);
-                               service->ipconfig_ipv4 = NULL;
-                       }
-
-                       if (__connman_ipconfig_disable(
-                                       service->ipconfig_ipv6) == 0) {
-                               connman_ipconfig_unref(service->ipconfig_ipv6);
-                               service->ipconfig_ipv6 = NULL;
-                       }
+                       __connman_ipconfig_disable(service->ipconfig_ipv4);
+                       __connman_ipconfig_disable(service->ipconfig_ipv6);
 
                        __connman_stats_service_unregister(service);
                        if (service->userconnect == TRUE)
@@ -3406,15 +3390,8 @@ int __connman_service_disconnect(struct connman_service *service)
        __connman_ipconfig_clear_address(service->ipconfig_ipv4);
        __connman_ipconfig_clear_address(service->ipconfig_ipv6);
 
-       if (__connman_ipconfig_disable(service->ipconfig_ipv4) == 0) {
-               connman_ipconfig_unref(service->ipconfig_ipv4);
-               service->ipconfig_ipv4 = NULL;
-       }
-
-       if (__connman_ipconfig_disable(service->ipconfig_ipv6) == 0) {
-               connman_ipconfig_unref(service->ipconfig_ipv6);
-               service->ipconfig_ipv6 = NULL;
-       }
+       __connman_ipconfig_disable(service->ipconfig_ipv4);
+       __connman_ipconfig_disable(service->ipconfig_ipv6);
 
        __connman_stats_service_unregister(service);