curl_sasl: revert the goto for error bailout

They were added because of an older code path that used allocations and
should not have been left in the code. With this change the logic goes
back to how it was.
This commit is contained in:
Daniel Stenberg 2014-06-11 23:32:10 +02:00
parent e95ca7cec9
commit 3aa1329e0a

View File

@ -456,10 +456,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* So far so good, now calculate A1 and H(A1) according to RFC 2831 */ /* So far so good, now calculate A1 and H(A1) according to RFC 2831 */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt)
result = CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
goto fail;
}
Curl_MD5_update(ctxt, (const unsigned char *) userp, Curl_MD5_update(ctxt, (const unsigned char *) userp,
curlx_uztoui(strlen(userp))); curlx_uztoui(strlen(userp)));
@ -472,10 +470,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
Curl_MD5_final(ctxt, digest); Curl_MD5_final(ctxt, digest);
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt)
result = CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
goto fail;
}
Curl_MD5_update(ctxt, (const unsigned char *) digest, MD5_DIGEST_LEN); Curl_MD5_update(ctxt, (const unsigned char *) digest, MD5_DIGEST_LEN);
Curl_MD5_update(ctxt, (const unsigned char *) ":", 1); Curl_MD5_update(ctxt, (const unsigned char *) ":", 1);
@ -495,10 +491,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Calculate H(A2) */ /* Calculate H(A2) */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt)
result = CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
goto fail;
}
Curl_MD5_update(ctxt, (const unsigned char *) method, Curl_MD5_update(ctxt, (const unsigned char *) method,
curlx_uztoui(strlen(method))); curlx_uztoui(strlen(method)));
@ -512,10 +506,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Now calculate the response hash */ /* Now calculate the response hash */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5); ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) { if(!ctxt)
result = CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
goto fail;
}
Curl_MD5_update(ctxt, (const unsigned char *) HA1_hex, 2 * MD5_DIGEST_LEN); Curl_MD5_update(ctxt, (const unsigned char *) HA1_hex, 2 * MD5_DIGEST_LEN);
Curl_MD5_update(ctxt, (const unsigned char *) ":", 1); Curl_MD5_update(ctxt, (const unsigned char *) ":", 1);
@ -545,16 +537,12 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
"qop=%s", "qop=%s",
userp, realm, nonce, userp, realm, nonce,
cnonce, nonceCount, uri, resp_hash_hex); cnonce, nonceCount, uri, resp_hash_hex);
if(!response) { if(!response)
result = CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
goto fail;
}
/* Base64 encode the response */ /* Base64 encode the response */
result = Curl_base64_encode(data, response, 0, outptr, outlen); result = Curl_base64_encode(data, response, 0, outptr, outlen);
fail:
free(response); free(response);
return result; return result;
} }