Skip to content

Commit

Permalink
curl_schannel.c: mark session as removed from cache if not freed
Browse files Browse the repository at this point in the history
If the session is still used by active SSL/TLS connections, it
cannot be closed yet. Thus we mark the session as not being cached
any longer so that the reference counting mechanism in
Curl_schannel_shutdown is used to close and free the session.

Reported-by: Jean-Francois Durand
  • Loading branch information
mback2k committed Jan 12, 2015
1 parent 710c38d commit e983480
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/vtls/curl_schannel.c
Expand Up @@ -1218,9 +1218,14 @@ void Curl_schannel_session_free(void *ptr)
{
struct curl_schannel_cred *cred = ptr;

if(cred && cred->cached && cred->refcount == 0) {
s_pSecFn->FreeCredentialsHandle(&cred->cred_handle);
Curl_safefree(cred);
if(cred && cred->cached) {
if(cred->refcount == 0) {
s_pSecFn->FreeCredentialsHandle(&cred->cred_handle);
Curl_safefree(cred);
}
else {
cred->cached = FALSE;
}
}
}

Expand Down

0 comments on commit e983480

Please sign in to comment.