aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-12-05 00:18:13 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-12-05 00:18:13 +0000
commit697592b3dd9b5e3338d74a4047caf260dacdb8dc (patch)
treec34fc9e9ad2557f3b56d5ee7de620e910b3af251 /lib
parentee1d729ce07aabb854e7e307583339819e5d2e47 (diff)
sasl_sspi: Free the Kerberos V5 challenge as soon as we're done with it
Reduced the amount of free's required for the decoded challenge message in Curl_sasl_create_gssapi_security_message() as a result of coding it differently in the sasl_gssapi module.
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_sasl_sspi.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c
index 99ea6cab3..883a0ee68 100644
--- a/lib/curl_sasl_sspi.c
+++ b/lib/curl_sasl_sspi.c
@@ -1046,18 +1046,16 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
return CURLE_BAD_CONTENT_ENCODING;
}
- /* Copy the data out and free the SSPI allocated buffer as it is not required
- anymore */
+ /* Copy the data out and free the challenge as it is not required anymore */
memcpy(&indata, input_buf[1].pvBuffer, 4);
s_pSecFn->FreeContextBuffer(input_buf[1].pvBuffer);
+ Curl_safefree(chlg);
/* Extract the security layer */
sec_layer = indata & 0x000000FF;
if(!(sec_layer & KERB_WRAP_NO_ENCRYPT)) {
infof(data, "GSSAPI handshake failure (invalid security layer)\n");
- Curl_safefree(chlg);
-
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -1074,17 +1072,13 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
/* Allocate the trailer */
trailer = malloc(sizes.cbSecurityTrailer);
- if(!trailer) {
- Curl_safefree(chlg);
-
+ if(!trailer)
return CURLE_OUT_OF_MEMORY;
- }
/* Convert the user name to UTF8 when operating with Unicode */
user_name = Curl_convert_tchar_to_UTF8(names.sUserName);
if(!user_name) {
Curl_safefree(trailer);
- Curl_safefree(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -1094,7 +1088,6 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
message = malloc(messagelen);
if(!message) {
Curl_safefree(trailer);
- Curl_safefree(chlg);
Curl_unicodefree(user_name);
return CURLE_OUT_OF_MEMORY;
@@ -1114,7 +1107,6 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
if(!padding) {
Curl_safefree(message);
Curl_safefree(trailer);
- Curl_safefree(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -1140,7 +1132,6 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
Curl_safefree(padding);
Curl_safefree(message);
Curl_safefree(trailer);
- Curl_safefree(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -1153,7 +1144,6 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
Curl_safefree(padding);
Curl_safefree(message);
Curl_safefree(trailer);
- Curl_safefree(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -1174,7 +1164,6 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
Curl_safefree(padding);
Curl_safefree(message);
Curl_safefree(trailer);
- Curl_safefree(chlg);
return result;
}