As __connman_connection_gateway_remove() may unref service, wrap
network.c:set_disconnected() with connman_service_ref/unref to make
sure the struct stays around during the function call.
---
 src/network.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/network.c b/src/network.c
index b388995..de1464c 100644
--- a/src/network.c
+++ b/src/network.c
@@ -703,6 +703,8 @@ static void set_disconnected(struct connman_network 
*network)
        struct connman_service *service;
 
        service = connman_service_lookup_from_network(network);
+       if (service)
+               connman_service_ref(service);
 
        ipconfig_ipv4 = __connman_service_get_ip4config(service);
        ipconfig_ipv6 = __connman_service_get_ip6config(service);
@@ -801,6 +803,9 @@ static void set_disconnected(struct connman_network 
*network)
        network->connected = false;
 
        connman_network_set_associating(network, false);
+
+       if (service)
+               connman_service_unref(service);
 }
 
 
-- 
1.9.1

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to