From 69d07feb145bd4e34c5740946ea0ef405f98f628 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 2 Jun 2010 12:44:46 +0200 Subject: fix spnego memory leak --- lib/http_negotiate.c | 8 ++++++-- 1 file 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); -- cgit v1.2.3