summaryrefslogtreecommitdiff
path: root/lib/http_negotiate.c
diff options
context:
space:
mode:
authorIsaac Boukris <iboukris@gmail.com>2016-11-09 15:37:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-11-09 15:02:02 +0100
commit46f906a1b0e987ff8a044595550ba2a0e3d6368c (patch)
tree7663cca22d7c68450f01c6d1f71fecbcd6e823cb /lib/http_negotiate.c
parent1299df6868e48ffbec747670017f74d18b1bcc9a (diff)
downloadcurl-46f906a1b0e987ff8a044595550ba2a0e3d6368c.tar.gz
SPNEGO: Fix memory leak when authentication fails
If SPNEGO fails, cleanup the negotiate handle right away. Fixes #1115 Signed-off-by: Isaac Boukris <iboukris@gmail.com> Reported-by: ashman-p
Diffstat (limited to 'lib/http_negotiate.c')
-rw-r--r--lib/http_negotiate.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index eb17ed4f2..5ea9f3401 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -37,6 +37,7 @@
CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
const char *header)
{
+ CURLcode result;
struct Curl_easy *data = conn->data;
size_t len;
@@ -89,8 +90,13 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
}
/* Initilise the security context and decode our challenge */
- return Curl_auth_decode_spnego_message(data, userp, passwdp, service, host,
- header, neg_ctx);
+ result = Curl_auth_decode_spnego_message(data, userp, passwdp, service,
+ host, header, neg_ctx);
+
+ if(result)
+ Curl_auth_spnego_cleanup(neg_ctx);
+
+ return result;
}
CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)