Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I65373f2cd5a33381da1e51ed7ab7a8b1358cef29
vec_free (fs->slices);
vec_foreach (fs->mqs, mq)
- vec_free (mq->rings);
+ svm_msg_q_cleanup (mq);
vec_free (fs->mqs);
}
clib_spinlock_init (&mq->q.lock);
}
+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);
}
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
*