summaryrefslogtreecommitdiff
path: root/src/connection.c
diff options
context:
space:
mode:
authorYu A Wang <arron.wang@intel.com>2011-12-19 03:00:17 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-01-13 16:15:06 +0100
commitb68795352dd5a9ac41eab31c765ade0c88329a6e (patch)
tree198e4925d2ac67ed574e948f550801457d68a4ed /src/connection.c
parente6e6fe0dc39457c0c10fa0e5c549be6439cdc88e (diff)
downloadconnman-b68795352dd5a9ac41eab31c765ade0c88329a6e.tar.gz
connman-b68795352dd5a9ac41eab31c765ade0c88329a6e.tar.bz2
connman-b68795352dd5a9ac41eab31c765ade0c88329a6e.zip
connection: Fix service refcount
Service may be refcount two times when add_gateway for both ipv4 and ipv6, we need to unref the service twice according when we have both ipv6 and ipv4 gateway
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c
index 54f2b740..58adfeb6 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -713,6 +713,14 @@ void __connman_connection_gateway_remove(struct connman_service *service,
err = disable_gateway(data, type);
/*
+ * We may refcount service twice seperately for ipv4 and ipv6
+ * then we need to unref accordingly.
+ */
+ if (do_ipv4 == do_ipv6 && data->ipv4_gateway != NULL &&
+ data->ipv6_gateway != NULL)
+ connman_service_unref(service);
+
+ /*
* We remove the service from the hash only if all the gateway
* settings are to be removed.
*/