diff options
author | Florin Coras <fcoras@cisco.com> | 2021-03-30 00:23:54 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-03-30 13:17:42 +0000 |
commit | 8c517c8fb44e7003ecdb615bc03163536e24d4d4 (patch) | |
tree | f073b3ea507a71b30d97cf42a6c10ee7c4af51af /src/svm | |
parent | f632ab5e3ba1882106975814597a8e39507d8873 (diff) |
svm: cleanup mq private data on fifo segment cleanup
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I65373f2cd5a33381da1e51ed7ab7a8b1358cef29
Diffstat (limited to 'src/svm')
-rw-r--r-- | src/svm/fifo_segment.c | 2 | ||||
-rw-r--r-- | src/svm/message_queue.c | 11 | ||||
-rw-r--r-- | src/svm/message_queue.h | 5 |
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 |