aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/http_negotiate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index d51d45631..ab1296e5b 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -305,11 +305,15 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
infof(conn->data, "Make SPNEGO Initial Token failed\n");
}
else {
- free(neg_ctx->output_token.value);
+ free(responseToken);
responseToken = NULL;
+ free(neg_ctx->output_token.value);
neg_ctx->output_token.value = malloc(spnegoTokenLength);
- if(neg_ctx->output_token.value == NULL)
+ if(neg_ctx->output_token.value == NULL) {
+ free(spnegoToken);
+ spnegoToken = NULL;
return CURLE_OUT_OF_MEMORY;
+ }
memcpy(neg_ctx->output_token.value, spnegoToken,spnegoTokenLength);
neg_ctx->output_token.length = spnegoTokenLength;
free(spnegoToken);