From 158029752c5f5e653b70e914f1c953fd9233c8bd Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 24 Apr 2013 11:20:54 -0700 Subject: [PATCH] only reset session cache with lock --- src/ssl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index ecf97bca2..24a0ee7c9 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -2628,6 +2628,7 @@ int CyaSSL_restore_session_cache(const char *fname) ret = (int)XFREAD(SessionCache + i, sizeof(SessionRow), 1, file); if (ret != 1) { CYASSL_MSG("Session cache member file read failed"); + XMEMSET(SessionCache, 0, sizeof SessionCache); rc = FREAD_ERROR; break; } @@ -2635,9 +2636,6 @@ int CyaSSL_restore_session_cache(const char *fname) UnLockMutex(&session_mutex); - if (rc != SSL_SUCCESS) - XMEMSET(SessionCache, 0, sizeof SessionCache); - XFCLOSE(file); CYASSL_LEAVE("CyaSSL_restore_session_cache", rc);