aboutsummaryrefslogtreecommitdiff
path: root/lib/http_digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http_digest.c')
-rw-r--r--lib/http_digest.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/http_digest.c b/lib/http_digest.c
index 2aeb3b8e9..7f62c26b4 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -65,7 +65,8 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
if(checkprefix("Digest", header)) {
header += strlen("Digest");
- data->state.digest.algo = CURLDIGESTALGO_MD5; /* default algorithm */
+ /* clear off any former leftovers and init to defaults */
+ Curl_digest_cleanup(data);
while(more) {
char value[32];
@@ -207,4 +208,21 @@ CURLcode Curl_output_digest(struct connectdata *conn,
return CURLE_OK;
}
+void Curl_digest_cleanup(struct SessionHandle *data)
+{
+ if(data->state.digest.nonce)
+ free(data->state.digest.nonce);
+ data->state.digest.nonce = NULL;
+
+ if(data->state.digest.cnonce)
+ free(data->state.digest.cnonce);
+ data->state.digest.cnonce = NULL;
+
+ if(data->state.digest.realm)
+ free(data->state.digest.realm);
+ data->state.digest.realm = NULL;
+
+ data->state.digest.algo = CURLDIGESTALGO_MD5; /* default algorithm */
+}
+
#endif