summaryrefslogtreecommitdiffstats
path: root/crypto/srp
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-08-23 00:20:45 +0200
committerMatt Caswell <matt@openssl.org>2016-08-23 01:19:15 +0200
commit85d6b09ddaf32a67a351521f84651c3193286663 (patch)
treeaab881531752c54d818b76f03052c972d3a353fe /crypto/srp
parentFix mem leak on error path (diff)
downloadopenssl-85d6b09ddaf32a67a351521f84651c3193286663.tar.xz
openssl-85d6b09ddaf32a67a351521f84651c3193286663.zip
Fix mem leak on error path
The mem pointed to by cAB can be leaked on an error path. Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/srp')
-rw-r--r--crypto/srp/srp_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/srp/srp_lib.c b/crypto/srp/srp_lib.c
index 9efad9352f..f146f820e7 100644
--- a/crypto/srp/srp_lib.c
+++ b/crypto/srp/srp_lib.c
@@ -84,7 +84,7 @@ BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
|| !EVP_DigestUpdate(ctxt, cAB + BN_bn2bin(A, cAB + longN), longN)
|| !EVP_DigestUpdate(ctxt, cAB + BN_bn2bin(B, cAB + longN), longN))
goto err;
- OPENSSL_free(cAB);
+
if (!EVP_DigestFinal_ex(ctxt, cu, NULL))
goto err;
@@ -94,7 +94,9 @@ BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
BN_free(u);
u = NULL;
}
+
err:
+ OPENSSL_free(cAB);
EVP_MD_CTX_free(ctxt);
return u;