tidy-up: use curlx_safefree()

Closes #21700
This commit is contained in:
Viktor Szakats 2026-05-20 20:43:59 +02:00
parent d3b04e5600
commit bcd0497c81
No known key found for this signature in database
19 changed files with 41 additions and 80 deletions

View file

@ -155,8 +155,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
krb5->p_identity, NULL, NULL,
krb5->credentials, NULL);
if(status != SEC_E_OK) {
curlx_free(krb5->credentials);
krb5->credentials = NULL;
curlx_safefree(krb5->credentials);
return CURLE_LOGIN_DENIED;
}
@ -433,15 +432,13 @@ void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5)
/* Free our security context */
if(krb5->context) {
Curl_pSecFn->DeleteSecurityContext(krb5->context);
curlx_free(krb5->context);
krb5->context = NULL;
curlx_safefree(krb5->context);
}
/* Free our credentials handle */
if(krb5->credentials) {
Curl_pSecFn->FreeCredentialsHandle(krb5->credentials);
curlx_free(krb5->credentials);
krb5->credentials = NULL;
curlx_safefree(krb5->credentials);
}
/* Free our identity */

View file

@ -140,8 +140,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
ntlm->p_identity, NULL, NULL,
ntlm->credentials, NULL);
if(status != SEC_E_OK) {
curlx_free(ntlm->credentials);
ntlm->credentials = NULL;
curlx_safefree(ntlm->credentials);
return CURLE_LOGIN_DENIED;
}
@ -328,15 +327,13 @@ void Curl_auth_cleanup_ntlm(struct ntlmdata *ntlm)
/* Free our security context */
if(ntlm->context) {
Curl_pSecFn->DeleteSecurityContext(ntlm->context);
curlx_free(ntlm->context);
ntlm->context = NULL;
curlx_safefree(ntlm->context);
}
/* Free our credentials handle */
if(ntlm->credentials) {
Curl_pSecFn->FreeCredentialsHandle(ntlm->credentials);
curlx_free(ntlm->credentials);
ntlm->credentials = NULL;
curlx_safefree(ntlm->credentials);
}
/* Free our identity */

View file

@ -160,8 +160,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
nego->p_identity, NULL, NULL,
nego->credentials, NULL);
if(nego->status != SEC_E_OK) {
curlx_free(nego->credentials);
nego->credentials = NULL;
curlx_safefree(nego->credentials);
return CURLE_AUTH_ERROR;
}
@ -323,15 +322,13 @@ void Curl_auth_cleanup_spnego(struct negotiatedata *nego)
/* Free our security context */
if(nego->context) {
Curl_pSecFn->DeleteSecurityContext(nego->context);
curlx_free(nego->context);
nego->context = NULL;
curlx_safefree(nego->context);
}
/* Free our credentials handle */
if(nego->credentials) {
Curl_pSecFn->FreeCredentialsHandle(nego->credentials);
curlx_free(nego->credentials);
nego->credentials = NULL;
curlx_safefree(nego->credentials);
}
/* Free our identity */