diff options
author | Steven Luong <sluong@cisco.com> | 2024-06-28 15:12:11 -0700 |
---|---|---|
committer | Steven Luong <sluong@cisco.com> | 2024-06-28 15:19:08 -0700 |
commit | d2d41bc34e1663803037fc0a6c7bda9078cef2b6 (patch) | |
tree | f067ffe0b6b6aaaae19dad00ec3f10173d758a98 /src/vnet/session/application_local.c | |
parent | 6d44aabe8d5e0015fd851788ef7c7bee48340dee (diff) |
session: memory leaks on various transports when session disable and enable
When toggling session disable and enable, memory leaks found on various
transports.
Don't create the timer wheels on enable when they are already creaded.
Don't create the spin locks when they are already created.
Add session enable disable test in session unit test.
Type: fix
Change-Id: I08988a96bbf2d67a67c743b50b63f5b1e27402a3
Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'src/vnet/session/application_local.c')
-rw-r--r-- | src/vnet/session/application_local.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 3cb743d10e0..064dd6fe77e 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -1350,13 +1350,21 @@ ct_enable_disable (vlib_main_t * vm, u8 is_en) ct_main_t *cm = &ct_main; ct_worker_t *wrk; + if (is_en == 0) + return 0; + cm->n_workers = vlib_num_workers (); cm->fwrk_thread = transport_cl_thread (); vec_validate (cm->wrk, vtm->n_vlib_mains); vec_foreach (wrk, cm->wrk) - clib_spinlock_init (&wrk->pending_connects_lock); - clib_spinlock_init (&cm->ho_reuseable_lock); - clib_rwlock_init (&cm->app_segs_lock); + { + if (wrk->pending_connects_lock == 0) + clib_spinlock_init (&wrk->pending_connects_lock); + } + if (cm->ho_reuseable_lock == 0) + clib_spinlock_init (&cm->ho_reuseable_lock); + if (cm->app_segs_lock == 0) + clib_rwlock_init (&cm->app_segs_lock); vec_validate (cm->fwrk_pending_connects, cm->n_workers); return 0; } |