summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipcpd/unicast/dir/dht.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ipcpd/unicast/dir/dht.c b/src/ipcpd/unicast/dir/dht.c
index d0523eee..656b8b94 100644
--- a/src/ipcpd/unicast/dir/dht.c
+++ b/src/ipcpd/unicast/dir/dht.c
@@ -3646,6 +3646,11 @@ static void dht_kv_update_replication_times(const uint8_t * key,
pthread_rwlock_unlock(&dht.db.lock);
}
+static void __cleanup_value_list(void * o)
+{
+ return value_list_destroy((struct list_head *) o);
+}
+
static void dht_kv_replicate_values(const uint8_t * key,
struct list_head * repl,
struct list_head * rebl)
@@ -3656,6 +3661,9 @@ static void dht_kv_replicate_values(const uint8_t * key,
clock_gettime(CLOCK_REALTIME_COARSE, &now);
+ pthread_cleanup_push(__cleanup_value_list, repl);
+ pthread_cleanup_push(__cleanup_value_list, rebl);
+
list_for_each_safe(p, h, repl) {
struct val_entry * v;
v = list_entry(p, struct val_entry, next);
@@ -3668,6 +3676,9 @@ static void dht_kv_replicate_values(const uint8_t * key,
dht_kv_republish_value(key, v, &now);
}
+ pthread_cleanup_pop(false);
+ pthread_cleanup_pop(false);
+
/* removes non-replicated items from the list */
dht_kv_update_replication_times(key, repl, rebl, &now);