summaryrefslogtreecommitdiff
path: root/vpn/vpn-ipconfig.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-11-12 14:07:39 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-23 12:58:51 +0200
commit7a2d659d0a862f3f78219e68e2e960e97b39d8b9 (patch)
tree2f4b6514a6fd6e1510412c3e268e2b634317a4fe /vpn/vpn-ipconfig.c
parentc619cdf8bcbb6f10909f1628b1106007b8410cb7 (diff)
downloadconnman-7a2d659d0a862f3f78219e68e2e960e97b39d8b9.tar.gz
connman-7a2d659d0a862f3f78219e68e2e960e97b39d8b9.tar.bz2
connman-7a2d659d0a862f3f78219e68e2e960e97b39d8b9.zip
ipconfig: Add ipconfig unref function
Diffstat (limited to 'vpn/vpn-ipconfig.c')
-rw-r--r--vpn/vpn-ipconfig.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/vpn/vpn-ipconfig.c b/vpn/vpn-ipconfig.c
index cb5167f0..7e1d77e6 100644
--- a/vpn/vpn-ipconfig.c
+++ b/vpn/vpn-ipconfig.c
@@ -257,6 +257,23 @@ int __vpn_ipconfig_gateway_add(struct vpn_ipconfig *ipconfig, int family)
return 0;
}
+void __vpn_ipconfig_unref_debug(struct vpn_ipconfig *ipconfig,
+ const char *file, int line, const char *caller)
+{
+ if (ipconfig == NULL)
+ return;
+
+ DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount - 1,
+ file, line, caller);
+
+ if (__sync_fetch_and_sub(&ipconfig->refcount, 1) != 1)
+ return;
+
+ connman_ipaddress_free(ipconfig->system);
+ connman_ipaddress_free(ipconfig->address);
+ g_free(ipconfig);
+}
+
static struct vpn_ipconfig *create_ipv6config(int index)
{
struct vpn_ipconfig *ipv6config;