diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/irmd/main.c | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aef9c8ed..8421199b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(GNUInstallDirs) set(PACKAGE_VERSION_MAJOR 0) set(PACKAGE_VERSION_MINOR 10) -set(PACKAGE_VERSION_PATCH 2) +set(PACKAGE_VERSION_PATCH 3) set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") diff --git a/src/irmd/main.c b/src/irmd/main.c index 64c9efc3..f9cb8fd2 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1555,17 +1555,23 @@ static void irm_fini(void) if (irmd_get_state() != IRMD_NULL) log_warn("Unsafe destroy."); + close(irmd.sockfd); + + if (unlink(IRM_SOCK_PATH)) + log_dbg("Failed to unlink %s.", IRM_SOCK_PATH); + pthread_rwlock_wrlock(&irmd.flows_lock); if (irmd.port_ids != NULL) bmp_destroy(irmd.port_ids); - pthread_rwlock_unlock(&irmd.flows_lock); - - close(irmd.sockfd); + list_for_each_safe(p, h, &irmd.irm_flows) { + struct irm_flow * f = list_entry(p, struct irm_flow, next); + list_del(&f->next); + irm_flow_destroy(f); + } - if (unlink(IRM_SOCK_PATH)) - log_dbg("Failed to unlink %s.", IRM_SOCK_PATH); + pthread_rwlock_unlock(&irmd.flows_lock); pthread_rwlock_wrlock(&irmd.reg_lock); /* Clear the lists. */ @@ -1609,6 +1615,7 @@ static void irm_fini(void) pthread_mutex_destroy(&irmd.cmd_lock); pthread_cond_destroy(&irmd.cmd_cond); + pthread_rwlock_destroy(&irmd.flows_lock); pthread_rwlock_destroy(&irmd.reg_lock); pthread_rwlock_destroy(&irmd.state_lock); |