svm: cleanup mq private data on fifo segment cleanup
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I65373f2cd5a33381da1e51ed7ab7a8b1358cef29
This commit is contained in:

committed by
Damjan Marion

parent
f632ab5e3b
commit
8c517c8fb4
@ -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);
|
||||
}
|
||||
|
@ -166,11 +166,20 @@ svm_msg_q_attach (svm_msg_q_t *mq, void *smq_base)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,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
|
||||
*
|
||||
|
Reference in New Issue
Block a user