tls: use safe pool reallocs

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ia2c771cbf826526d2d06b6da022509ab02917350
This commit is contained in:
Florin Coras
2022-03-29 17:49:37 -07:00
committed by Dave Wallace
parent d82c39e5ff
commit 009303dc06
5 changed files with 14 additions and 56 deletions

View File

@@ -40,7 +40,8 @@ openssl_ctx_alloc_w_thread (u32 thread_index)
openssl_main_t *om = &openssl_main;
openssl_ctx_t **ctx;
pool_get (om->ctx_pool[thread_index], ctx);
pool_get_aligned_safe (om->ctx_pool[thread_index], ctx, 0);
if (!(*ctx))
*ctx = clib_mem_alloc (sizeof (openssl_ctx_t));
@@ -99,7 +100,7 @@ openssl_ctx_attach (u32 thread_index, void *ctx_ptr)
session_handle_t sh;
openssl_ctx_t **oc;
pool_get (om->ctx_pool[thread_index], oc);
pool_get_aligned_safe (om->ctx_pool[thread_index], oc, 0);
/* Free the old instance instead of looking for an empty spot */
if (*oc)
clib_mem_free (*oc);