summaryrefslogtreecommitdiff
path: root/src/counter.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-10-08 23:36:44 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-08 23:36:44 +0200
commitd8ca643864d54183330618f0418ba0388e4b9dde (patch)
tree1c5ad7c477829abecbc93c49737b9c79bd7223ba /src/counter.c
parente902fab6a63e2df6c0ad4953a7b10522f85e2205 (diff)
downloadconnman-d8ca643864d54183330618f0418ba0388e4b9dde.tar.gz
connman-d8ca643864d54183330618f0418ba0388e4b9dde.tar.bz2
connman-d8ca643864d54183330618f0418ba0388e4b9dde.zip
Release counter and session watches whe unregistering
Releasing the watches from the hash table freeing routines lead to double freeing the interface data watch pointer in case the owner would disappear before unregistering.
Diffstat (limited to 'src/counter.c')
-rw-r--r--src/counter.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/counter.c b/src/counter.c
index 6a0a994c..4fc47488 100644
--- a/src/counter.c
+++ b/src/counter.c
@@ -45,9 +45,6 @@ static void remove_counter(gpointer user_data)
DBG("owner %s path %s", counter->owner, counter->path);
- if (counter->watch > 0)
- g_dbus_remove_watch(connection, counter->watch);
-
__connman_rtnl_update_interval_remove(counter->interval);
__connman_service_counter_unregister(counter->path);
@@ -119,6 +116,9 @@ int __connman_counter_unregister(const char *owner, const char *path)
if (g_strcmp0(owner, counter->owner) != 0)
return -EACCES;
+ if (counter->watch > 0)
+ g_dbus_remove_watch(connection, counter->watch);
+
g_hash_table_remove(owner_mapping, counter->owner);
g_hash_table_remove(counter_table, counter->path);
@@ -150,6 +150,9 @@ static void release_counter(gpointer key, gpointer value, gpointer user_data)
DBG("owner %s path %s", counter->owner, counter->path);
+ if (counter->watch > 0)
+ g_dbus_remove_watch(connection, counter->watch);
+
message = dbus_message_new_method_call(counter->owner, counter->path,
CONNMAN_COUNTER_INTERFACE, "Release");
if (message == NULL)