aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/svm/fifo_segment.c2
-rw-r--r--src/svm/message_queue.c11
-rw-r--r--src/svm/message_queue.h5
3 files changed, 16 insertions, 2 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c
index 986778dfe82..00fb023f3cb 100644
--- a/src/svm/fifo_segment.c
+++ b/src/svm/fifo_segment.c
@@ -814,7 +814,7 @@ fifo_segment_cleanup (fifo_segment_t *fs)
vec_free (fs->slices);
vec_foreach (fs->mqs, mq)
- vec_free (mq->rings);
+ svm_msg_q_cleanup (mq);
vec_free (fs->mqs);
}
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c
index e08ba06fb27..a6af7962f73 100644
--- a/src/svm/message_queue.c
+++ b/src/svm/message_queue.c
@@ -167,10 +167,19 @@ svm_msg_q_attach (svm_msg_q_t *mq, void *smq_base)
}
void
+svm_msg_q_cleanup (svm_msg_q_t *mq)
+{
+ vec_free (mq->rings);
+ clib_spinlock_free (&mq->q.lock);
+ if (mq->q.evtfd != -1)
+ close (mq->q.evtfd);
+}
+
+void
svm_msg_q_free (svm_msg_q_t * mq)
{
+ svm_msg_q_cleanup (mq);
clib_mem_free (mq->q.shr);
- clib_spinlock_free (&mq->q.lock);
clib_mem_free (mq);
}
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 0e402c5a409..bd76eda5d88 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -126,6 +126,11 @@ uword svm_msg_q_size_to_alloc (svm_msg_q_cfg_t *cfg);
void svm_msg_q_attach (svm_msg_q_t *mq, void *smq_base);
/**
+ * Cleanup mq's private data
+ */
+void svm_msg_q_cleanup (svm_msg_q_t *mq);
+
+/**
* Free message queue
*
* @param mq message queue to be freed