diff options
-rw-r--r-- | lib/vtls/curl_schannel.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/vtls/curl_schannel.c b/lib/vtls/curl_schannel.c index b3fe52695..787929c1d 100644 --- a/lib/vtls/curl_schannel.c +++ b/lib/vtls/curl_schannel.c @@ -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; + } } } |