projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix mem leak on error path
[openssl.git]
/
crypto
/
srp
/
srp_lib.c
diff --git
a/crypto/srp/srp_lib.c
b/crypto/srp/srp_lib.c
index 7f297be81aab7a8b73cf679938349e177f68da82..9efad9352fb2168c59c13d0eacd2c970f6d8b302 100644
(file)
--- a/
crypto/srp/srp_lib.c
+++ b/
crypto/srp/srp_lib.c
@@
-19,7
+19,7
@@
static BIGNUM *srp_Calc_k(const BIGNUM *N, const BIGNUM *g)
/* k = SHA1(N | PAD(g)) -- tls-srp draft 8 */
unsigned char digest[SHA_DIGEST_LENGTH];
/* k = SHA1(N | PAD(g)) -- tls-srp draft 8 */
unsigned char digest[SHA_DIGEST_LENGTH];
- unsigned char *tmp;
+ unsigned char *tmp
= NULL
;
EVP_MD_CTX *ctxt = NULL;
int longg;
int longN = BN_num_bytes(N);
EVP_MD_CTX *ctxt = NULL;
int longg;
int longN = BN_num_bytes(N);
@@
-45,12
+45,12
@@
static BIGNUM *srp_Calc_k(const BIGNUM *N, const BIGNUM *g)
if (!EVP_DigestUpdate(ctxt, tmp + longg, longN - longg)
|| !EVP_DigestUpdate(ctxt, tmp, longg))
goto err;
if (!EVP_DigestUpdate(ctxt, tmp + longg, longN - longg)
|| !EVP_DigestUpdate(ctxt, tmp, longg))
goto err;
- OPENSSL_free(tmp);
if (!EVP_DigestFinal_ex(ctxt, digest, NULL))
goto err;
res = BN_bin2bn(digest, sizeof(digest), NULL);
err:
if (!EVP_DigestFinal_ex(ctxt, digest, NULL))
goto err;
res = BN_bin2bn(digest, sizeof(digest), NULL);
err:
+ OPENSSL_free(tmp);
EVP_MD_CTX_free(ctxt);
return res;
}
EVP_MD_CTX_free(ctxt);
return res;
}