diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2013-04-07 09:44:29 +0200 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2013-04-07 09:44:29 +0200 |
commit | 4b643f1ca44e91683be8697709b786efd43c64ef (patch) | |
tree | 72e8204b4b78fb3ee88d38eba06167b595be1c08 | |
parent | e73db5dcbdff6763da5f8c97fe1070b4711d5a0a (diff) |
curl_schannel.c: Follow up on memory leak fix ae4558d
-rw-r--r-- | lib/curl_schannel.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/curl_schannel.c b/lib/curl_schannel.c index f4e4619d1..863d4712d 100644 --- a/lib/curl_schannel.c +++ b/lib/curl_schannel.c @@ -1132,17 +1132,21 @@ int Curl_schannel_shutdown(struct connectdata *conn, int sockindex) Curl_safefree(connssl->ctxt); } - /* decrement the reference counter of the credential/session handle */ - if(connssl->cred && connssl->cred->refcount > 0) { - connssl->cred->refcount--; - infof(data, "schannel: decremented credential handle refcount = %d\n", - connssl->cred->refcount); - } + /* free SSPI Schannel API credential handle */ + if(connssl->cred) { + /* decrement the reference counter of the credential/session handle */ + if(connssl->cred->refcount > 0) { + connssl->cred->refcount--; + infof(data, "schannel: decremented credential handle refcount = %d\n", + connssl->cred->refcount); + } - /* if the handle refcount is zero, check if we have not cached it */ - if(connssl->cred && connssl->cred->refcount == 0) { - /* if the handle was not cached, it is stale to be freed */ - if(!Curl_ssl_getsessionid(conn, (void**)&cached_cred, NULL)) { + /* if the handle refcount is zero, check if we have not cached it */ + if(connssl->cred->refcount == 0) { + if(Curl_ssl_getsessionid(conn, (void**)&cached_cred, NULL)) { + cached_cred = NULL; + } + /* if the handle was not cached, it is stale to be freed */ if(connssl->cred != cached_cred) { infof(data, "schannel: clear credential handle\n"); s_pSecFn->FreeCredentialsHandle(&connssl->cred->cred_handle); |