only reset session cache with lock

This commit is contained in:
toddouska
2013-04-24 11:20:54 -07:00
parent f12ba533e2
commit 158029752c

View File

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