From: Pekka Pessi <[email protected]>

The connman_network_set_group() created an extra ref to service if it
was called before network was probed and registered.
---
 src/network.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/network.c b/src/network.c
index 551d737..42fe0b8 100644
--- a/src/network.c
+++ b/src/network.c
@@ -534,21 +534,24 @@ void connman_network_set_group(struct connman_network 
*network,
        }
 
        if (g_strcmp0(network->group, group) == 0) {
-               if (group != NULL)
+               if (group != NULL && network->registered)
                        __connman_profile_update_network(network);
                return;
        }
 
        if (network->group != NULL) {
-               __connman_profile_remove_network(network);
+               if (network->registered)
+                       __connman_profile_remove_network(network);
 
                g_free(network->group);
        }
 
        network->group = g_strdup(group);
 
-       if (network->group != NULL)
-               __connman_profile_add_network(network);
+       if (network->group != NULL) {
+               if (network->registered)
+                       __connman_profile_add_network(network);
+       }
 }
 
 /**
@@ -1745,7 +1748,8 @@ static void network_remove(struct connman_element 
*element)
        case CONNMAN_NETWORK_TYPE_WIFI:
        case CONNMAN_NETWORK_TYPE_WIMAX:
                if (network->group != NULL) {
-                       __connman_profile_remove_network(network);
+                       if (network->registered)
+                               __connman_profile_remove_network(network);
 
                        g_free(network->group);
                        network->group = NULL;
-- 
1.7.0.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to