Commit 58e33fcd authored by Mark Andrews's avatar Mark Andrews
Browse files

unlink before unlock

(cherry picked from commit 4742f4ec)
parent 1bbed57e
...@@ -513,6 +513,7 @@ free_session_list(pk11_sessionlist_t *slist) { ...@@ -513,6 +513,7 @@ free_session_list(pk11_sessionlist_t *slist) {
LOCK(&sessionlock); LOCK(&sessionlock);
while (!ISC_LIST_EMPTY(*slist)) { while (!ISC_LIST_EMPTY(*slist)) {
sp = ISC_LIST_HEAD(*slist); sp = ISC_LIST_HEAD(*slist);
ISC_LIST_UNLINK(*slist, sp, link);
UNLOCK(&sessionlock); UNLOCK(&sessionlock);
if (sp->session != CK_INVALID_HANDLE) { if (sp->session != CK_INVALID_HANDLE) {
rv = pkcs_C_CloseSession(sp->session); rv = pkcs_C_CloseSession(sp->session);
...@@ -520,7 +521,6 @@ free_session_list(pk11_sessionlist_t *slist) { ...@@ -520,7 +521,6 @@ free_session_list(pk11_sessionlist_t *slist) {
ret = DST_R_CRYPTOFAILURE; ret = DST_R_CRYPTOFAILURE;
} }
LOCK(&sessionlock); LOCK(&sessionlock);
ISC_LIST_UNLINK(*slist, sp, link);
pk11_mem_put(sp, sizeof(*sp)); pk11_mem_put(sp, sizeof(*sp));
} }
UNLOCK(&sessionlock); UNLOCK(&sessionlock);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment