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);