From d79d9f864f4dc146386547df5a1c6afced55b8cd Mon Sep 17 00:00:00 2001
From: dimitri staessens <dimitri.staessens@ugent.be>
Date: Wed, 29 Mar 2017 14:21:05 +0200
Subject: irmd: Set failed flows to FLOW_NULL before destroy

---
 src/irmd/irm_flow.c | 1 -
 src/irmd/main.c     | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c
index 8ca25b5b..99966561 100644
--- a/src/irmd/irm_flow.c
+++ b/src/irmd/irm_flow.c
@@ -125,7 +125,6 @@ enum flow_state irm_flow_get_state(struct irm_flow * f)
 void irm_flow_set_state(struct irm_flow * f, enum flow_state state)
 {
         assert(f);
-        assert(state != FLOW_NULL);
         assert(state != FLOW_DESTROY);
 
         pthread_mutex_lock(&f->state_lock);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 9a062cf3..afd60f4d 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1205,6 +1205,7 @@ static struct irm_flow * flow_alloc(pid_t     api,
                 bmp_release(irmd->port_ids, f->port_id);
                 pthread_rwlock_unlock(&irmd->flows_lock);
                 pthread_rwlock_unlock(&irmd->state_lock);
+                irm_flow_set_state(f, FLOW_NULL);
                 irm_flow_destroy(f);
                 return NULL;
         }
-- 
cgit v1.2.3