diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2014-10-04 18:24:23 +0200 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2014-10-04 18:24:23 +0200 |
commit | 330346d51c1a11a7607349e364c417fccfc42ef5 (patch) | |
tree | 57ad9e9290248114874c431c8df8e66ef932a35b /lib/vtls | |
parent | 8128db9ec19d6c15b5f1e239550a1c24a2f68022 (diff) |
curl_schannel.c: Fixed possible memory or handle leak
First try to fix possible memory leaks, in this case:
Only connssl->ctxt xor onnssl->cred being initialized.
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/curl_schannel.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/vtls/curl_schannel.c b/lib/vtls/curl_schannel.c index e4e595eaa..925df37a0 100644 --- a/lib/vtls/curl_schannel.c +++ b/lib/vtls/curl_schannel.c @@ -1145,29 +1145,29 @@ int Curl_schannel_shutdown(struct connectdata *conn, int sockindex) " (bytes written: %zd)\n", curl_easy_strerror(code), written); } } + } - /* free SSPI Schannel API security context handle */ - if(connssl->ctxt) { - infof(data, "schannel: clear security context handle\n"); - s_pSecFn->DeleteSecurityContext(&connssl->ctxt->ctxt_handle); - Curl_safefree(connssl->ctxt); - } + /* free SSPI Schannel API security context handle */ + if(connssl->ctxt) { + infof(data, "schannel: clear security context handle\n"); + s_pSecFn->DeleteSecurityContext(&connssl->ctxt->ctxt_handle); + Curl_safefree(connssl->ctxt); + } - /* 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); - } + /* 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 was not cached and the refcount is zero */ - if(!connssl->cred->cached && connssl->cred->refcount == 0) { - infof(data, "schannel: clear credential handle\n"); - s_pSecFn->FreeCredentialsHandle(&connssl->cred->cred_handle); - Curl_safefree(connssl->cred); - } + /* if the handle was not cached and the refcount is zero */ + if(!connssl->cred->cached && connssl->cred->refcount == 0) { + infof(data, "schannel: clear credential handle\n"); + s_pSecFn->FreeCredentialsHandle(&connssl->cred->cred_handle); + Curl_safefree(connssl->cred); } } |