Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
migueljcrum committed Sep 6, 2019
1 parent 0f37c8d commit 2a6cca6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/vauth/digest_sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ bool Curl_auth_is_digest_supported(void)
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
&SecurityPackage);

/* Release the package buffer as it is not required anymore */
if(status == SEC_E_OK) {
s_pSecFn->FreeContextBuffer(SecurityPackage);
}

return (status == SEC_E_OK ? TRUE : FALSE);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/vauth/krb5_sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ bool Curl_auth_is_gssapi_supported(void)
TEXT(SP_NAME_KERBEROS),
&SecurityPackage);

/* Release the package buffer as it is not required anymore */
if(status == SEC_E_OK) {
s_pSecFn->FreeContextBuffer(SecurityPackage);
}

return (status == SEC_E_OK ? TRUE : FALSE);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/vauth/ntlm_sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ bool Curl_auth_is_ntlm_supported(void)
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_NTLM),
&SecurityPackage);

/* Release the package buffer as it is not required anymore */
if(status == SEC_E_OK) {
s_pSecFn->FreeContextBuffer(SecurityPackage);
}

return (status == SEC_E_OK ? TRUE : FALSE);
}

Expand Down
6 changes: 6 additions & 0 deletions lib/vauth/spnego_sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ bool Curl_auth_is_spnego_supported(void)
TEXT(SP_NAME_NEGOTIATE),
&SecurityPackage);

/* Release the package buffer as it is not required anymore */
if(status == SEC_E_OK) {
s_pSecFn->FreeContextBuffer(SecurityPackage);
}


return (status == SEC_E_OK ? TRUE : FALSE);
}

Expand Down

0 comments on commit 2a6cca6

Please sign in to comment.