[PATCH v2] ipcpd: Cleanup pending DHT commands on shutdown

  • From: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Tue, 1 May 2018 14:03:58 +0200

The list of commands was not cleaned up on shutdown.

Signed-off-by: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
---
 src/ipcpd/normal/dht.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index 6d291a3..affec43 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -2625,6 +2625,13 @@ void dht_destroy(struct dht * dht)
 
         pthread_rwlock_wrlock(&dht->lock);
 
+        list_for_each_safe(p, h, &dht->cmds) {
+                struct cmd * c = list_entry(p, struct cmd, next);
+                list_del(&c->next);
+                ipcp_sdb_release(c->sdb);
+                free(c);
+        }
+
         list_for_each_safe(p, h, &dht->entries) {
                 struct dht_entry * e = list_entry(p, struct dht_entry, next);
                 list_del(&e->next);
-- 
2.17.0


Other related posts: