mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Fix session ticket leak in wolfSSL_Cleanup
This commit is contained in:
12
src/ssl.c
12
src/ssl.c
@ -14356,12 +14356,9 @@ int wolfSSL_Cleanup(void)
|
|||||||
{
|
{
|
||||||
int ret = WOLFSSL_SUCCESS; /* Only the first error will be returned */
|
int ret = WOLFSSL_SUCCESS; /* Only the first error will be returned */
|
||||||
int release = 0;
|
int release = 0;
|
||||||
#if !defined(NO_SESSION_CACHE) && (defined(ENABLE_SESSION_CACHE_ROW_LOCK) || \
|
#if !defined(NO_SESSION_CACHE)
|
||||||
defined(SESSION_CACHE_DYNAMIC_MEM))
|
|
||||||
int i;
|
int i;
|
||||||
#ifdef SESSION_CACHE_DYNAMIC_MEM
|
|
||||||
int j;
|
int j;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_Cleanup");
|
WOLFSSL_ENTER("wolfSSL_Cleanup");
|
||||||
@ -14406,17 +14403,20 @@ int wolfSSL_Cleanup(void)
|
|||||||
}
|
}
|
||||||
session_lock_valid = 0;
|
session_lock_valid = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SESSION_CACHE_DYNAMIC_MEM
|
|
||||||
for (i = 0; i < SESSION_ROWS; i++) {
|
for (i = 0; i < SESSION_ROWS; i++) {
|
||||||
for (j = 0; j < SESSIONS_PER_ROW; j++) {
|
for (j = 0; j < SESSIONS_PER_ROW; j++) {
|
||||||
|
#ifdef SESSION_CACHE_DYNAMIC_MEM
|
||||||
if (SessionCache[i].Sessions[j]) {
|
if (SessionCache[i].Sessions[j]) {
|
||||||
|
EvictSessionFromCache(SessionCache[i].Sessions[j]);
|
||||||
XFREE(SessionCache[i].Sessions[j], SessionCache[i].heap,
|
XFREE(SessionCache[i].Sessions[j], SessionCache[i].heap,
|
||||||
DYNAMIC_TYPE_SESSION);
|
DYNAMIC_TYPE_SESSION);
|
||||||
SessionCache[i].Sessions[j] = NULL;
|
SessionCache[i].Sessions[j] = NULL;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
EvictSessionFromCache(&SessionCache[i].Sessions[j]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifndef NO_CLIENT_CACHE
|
#ifndef NO_CLIENT_CACHE
|
||||||
if ((clisession_mutex_valid == 1) &&
|
if ((clisession_mutex_valid == 1) &&
|
||||||
(wc_FreeMutex(&clisession_mutex) != 0)) {
|
(wc_FreeMutex(&clisession_mutex) != 0)) {
|
||||||
|
Reference in New Issue
Block a user